Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.21k stars 3.82k forks source link

Get-AzResource behavior changed - getting generic resources instead of resource-provider specific resources #12278

Open petehauge opened 4 years ago

petehauge commented 4 years ago

Description

After upgrading to the latest version of Azure Powershell, my simple command is no longer working.

Get-AzResource -ExpandProperties -ResourceType "Microsoft.DevTestLab/labs" -ApiVersion "2018-10-15-preview"

image

This used to work fine, I would get a list of DevTest Labs based on the DTL resource provider (and the $_.Properties was populated). Now I get an error which looks like the call is going to the generic ARM resource provider instead of the Resource provider I'm specifying.

It looks like if I specify other properties (resource group & name) then I get the right provider, but it breaks a bunch of existing code I have... In addition, I'm trying to query for all the labs in the subscription, so I would need to do multiple calls to Azure to compile this list if I have to specify the name & RG name to get the properties...

Let me know if you need any more info from me!

Steps to reproduce

Get-AzResource -ExpandProperties -ResourceType "Microsoft.DevTestLab/labs" -ApiVersion "2018-10-15-preview"

Environment data

PS D:\Sources\DTL-VM-Generator> $PSVersionTable 

Name                           Value                                                                         
----                           -----                                                                         
PSVersion                      5.1.19041.1                                                                   
PSEdition                      Desktop                                                                       
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                       
BuildVersion                   10.0.19041.1                                                                  
CLRVersion                     4.0.30319.42000                                                               
WSManStackVersion              3.0                                                                           
PSRemotingProtocolVersion      2.3                                                                           
SerializationVersion           1.1.0.1    

Module versions


PS D:\Sources\DTL-VM-Generator> Get-Module  -ListAvailable

    Directory: C:\Users\phauge\Documents\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands                                   
---------- -------    ----                                ----------------                                   
Script     1.8.0      Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAuto...
Script     1.1.1      Az.Advisor                          {Get-AzAdvisorRecommendation, Enable-AzAdvisorRe...
Script     1.1.1      Az.Aks                              {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAk...
Script     1.1.2      Az.AnalysisServices                 {Resume-AzAnalysisServicesServer, Suspend-AzAnal...
Script     2.0.0      Az.ApiManagement                    {Add-AzApiManagementApiToProduct, Add-AzApiManag...
Script     1.1.0      Az.ApplicationInsights              {Get-AzApplicationInsights, New-AzApplicationIns...
Script     1.3.6      Az.Automation                       {Get-AzAutomationHybridWorkerGroup, Remove-AzAut...
Script     3.0.0      Az.Batch                            {Remove-AzBatchAccount, Get-AzBatchAccount, Get-...
Script     1.0.2      Az.Billing                          {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-...
Script     1.4.3      Az.Cdn                              {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-A...
Script     1.3.0      Az.CognitiveServices                {Get-AzCognitiveServicesAccount, Get-AzCognitive...
Script     4.1.0      Az.Compute                          {Remove-AzAvailabilitySet, Get-AzAvailabilitySet...
Script     1.0.3      Az.ContainerInstance                {New-AzContainerGroup, Get-AzContainerGroup, Rem...
Script     1.1.1      Az.ContainerRegistry                {New-AzContainerRegistry, Get-AzContainerRegistr...
Script     1.1.0      Az.DataBoxEdge                      {Get-AzDataBoxEdgeJob, Get-AzDataBoxEdgeDevice, ...
Script     1.8.0      Az.DataFactory                      {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Ge...
Script     1.0.2      Az.DataLakeAnalytics                {Get-AzDataLakeAnalyticsDataSource, New-AzDataLa...
Script     1.2.8      Az.DataLakeStore                    {Get-AzDataLakeStoreTrustedIdProvider, Remove-Az...
Script     1.1.0      Az.DeploymentManager                {Get-AzDeploymentManagerArtifactSource, New-AzDe...
Script     1.0.2      Az.DevTestLabs                      {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShu...
Script     1.1.2      Az.Dns                              {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remo...
Script     1.2.3      Az.EventGrid                        {New-AzEventGridTopic, Get-AzEventGridTopic, Set...
Script     1.4.3      Az.EventHub                         {New-AzEventHubNamespace, Get-AzEventHubNamespac...
Script     1.5.0      Az.FrontDoor                        {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDo...
Script     1.0.0      Az.Functions                        {Get-AzFunctionApp, Get-AzFunctionAppAvailableLo...
Script     3.2.0      Az.HDInsight                        {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefi...
Script     1.0.2      Az.HealthcareApis                   {New-AzHealthcareApisService, Remove-AzHealthcar...
Script     2.5.0      Az.IotHub                           {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGr...
Script     2.0.0      Az.KeyVault                         {Add-AzKeyVaultCertificate, Update-AzKeyVaultCer...
Script     1.3.2      Az.LogicApp                         {Get-AzIntegrationAccountAgreement, Get-AzIntegr...
Script     1.1.3      Az.MachineLearning                  {Move-AzMlCommitmentAssociation, Get-AzMlCommitm...
Script     1.0.0      Az.Maintenance                      {Get-AzApplyUpdate, Get-AzConfigurationAssignmen...
Script     1.0.2      Az.ManagedServices                  {Get-AzManagedServicesAssignment, New-AzManagedS...
Script     1.0.2      Az.MarketplaceOrdering              {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}   
Script     1.1.1      Az.Media                            {Sync-AzMediaServiceStorageKey, Set-AzMediaServi...
Script     2.0.0      Az.Monitor                          {Get-AzMetricDefinition, Get-AzMetric, Remove-Az...
Script     3.0.0      Az.Network                          {Add-AzApplicationGatewayAuthenticationCertifica...
Script     1.1.1      Az.NotificationHubs                 {Get-AzNotificationHub, Get-AzNotificationHubAut...
Script     2.0.0      Az.OperationalInsights              {New-AzOperationalInsightsAzureActivityLogDataSo...
Script     1.3.0      Az.PolicyInsights                   {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPol...
Script     1.1.1      Az.PowerBIEmbedded                  {Remove-AzPowerBIWorkspaceCollection, Get-AzPowe...
Script     1.0.2      Az.PrivateDns                       {Get-AzPrivateDnsZone, Remove-AzPrivateDnsZone, ...
Script     2.9.0      Az.RecoveryServices                 {Get-AzRecoveryServicesBackupProperty, Get-AzRec...
Script     1.2.1      Az.RedisCache                       {Remove-AzRedisCachePatchSchedule, New-AzRedisCa...
Script     1.0.3      Az.Relay                            {New-AzRelayNamespace, Get-AzRelayNamespace, Set...
Script     2.0.1      Az.Resources                        {Get-AzProviderOperation, Remove-AzRoleAssignmen...
Script     1.4.1      Az.ServiceBus                       {New-AzServiceBusNamespace, Get-AzServiceBusName...
Script     2.1.0      Az.ServiceFabric                    {Add-AzServiceFabricClientCertificate, Add-AzSer...
Script     1.1.1      Az.SignalR                          {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey,...
Script     2.6.1      Az.Sql                              {Get-AzSqlDatabaseTransparentDataEncryption, Get...
Script     1.1.0      Az.SqlVirtualMachine                {New-AzSqlVM, Get-AzSqlVM, Update-AzSqlVM, Remov...
Script     2.0.0      Az.Storage                          {Get-AzStorageAccount, Get-AzStorageAccountKey, ...
Script     1.2.3      Az.StorageSync                      {Invoke-AzStorageSyncCompatibilityCheck, New-AzS...
Script     1.0.1      Az.StreamAnalytics                  {Get-AzStreamAnalyticsFunction, Get-AzStreamAnal...
Script     1.0.0      Az.Support                          {Get-AzSupportService, Get-AzSupportProblemClass...
Script     1.0.4      Az.TrafficManager                   {Add-AzTrafficManagerCustomHeaderToEndpoint, Rem...
Script     1.9.0      Az.Websites                         {Get-AzAppServicePlan, Set-AzAppServicePlan, New...
Script     1.4.7      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider,...
Script     1.7.3.9    PoshRSJob                           {Get-RSJob, Receive-RSJob, Remove-RSJob, Start-R...
Script     5.1.1      PowerShellISE-preview               {Start-ISEPreview, Install-ISEPreviewShortcut, i...
Binary     2.0.1      ThreadJob                           Start-ThreadJob                                    

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands                                   
---------- -------    ----                                ----------------                                   
Script     1.0        ApplicationInsightsCustomEvents     Log-ApplicationInsightsEvent                       
Script     1.9.0      Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAuto...
Script     1.1.1      Az.Advisor                          {Get-AzAdvisorRecommendation, Enable-AzAdvisorRe...
Script     1.1.2      Az.Aks                              {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAk...
Script     1.1.3      Az.AnalysisServices                 {Resume-AzAnalysisServicesServer, Suspend-AzAnal...
Script     2.0.1      Az.ApiManagement                    {Add-AzApiManagementApiToProduct, Add-AzApiManag...
Script     1.1.0      Az.ApplicationInsights              {Get-AzApplicationInsights, New-AzApplicationIns...
Script     1.3.6      Az.Automation                       {Get-AzAutomationHybridWorkerGroup, Remove-AzAut...
Script     3.1.0      Az.Batch                            {Remove-AzBatchAccount, Get-AzBatchAccount, Get-...
Script     1.0.3      Az.Billing                          {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-...
Script     1.4.3      Az.Cdn                              {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-A...
Script     1.5.0      Az.CognitiveServices                {Get-AzCognitiveServicesAccount, Get-AzCognitive...
Script     4.2.0      Az.Compute                          {Remove-AzAvailabilitySet, Get-AzAvailabilitySet...
Script     1.0.3      Az.ContainerInstance                {New-AzContainerGroup, Get-AzContainerGroup, Rem...
Script     1.1.1      Az.ContainerRegistry                {New-AzContainerRegistry, Get-AzContainerRegistr...
Script     1.1.0      Az.DataBoxEdge                      {Get-AzDataBoxEdgeJob, Get-AzDataBoxEdgeDevice, ...
Script     1.8.2      Az.DataFactory                      {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Ge...
Script     1.0.2      Az.DataLakeAnalytics                {Get-AzDataLakeAnalyticsDataSource, New-AzDataLa...
Script     1.2.8      Az.DataLakeStore                    {Get-AzDataLakeStoreTrustedIdProvider, Remove-Az...
Script     1.0.0      Az.DataShare                        {New-AzDataShareAccount, Get-AzDataShareAccount,...
Script     1.1.0      Az.DeploymentManager                {Get-AzDeploymentManagerArtifactSource, New-AzDe...
Script     1.0.0      Az.DesktopVirtualization            {Disconnect-AzWvdUserSession, Get-AzWvdApplicati...
Script     1.0.2      Az.DevTestLabs                      {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShu...
Script     1.1.2      Az.Dns                              {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remo...
Script     1.2.3      Az.EventGrid                        {New-AzEventGridTopic, Get-AzEventGridTopic, Set...
Script     1.5.0      Az.EventHub                         {New-AzEventHubNamespace, Get-AzEventHubNamespac...
Script     1.5.0      Az.FrontDoor                        {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDo...
Script     1.0.1      Az.Functions                        {Get-AzFunctionApp, Get-AzFunctionAppAvailableLo...
Script     3.3.0      Az.HDInsight                        {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefi...
Script     1.1.0      Az.HealthcareApis                   {New-AzHealthcareApisService, Remove-AzHealthcar...
Script     2.5.0      Az.IotHub                           {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGr...
Script     2.0.0      Az.KeyVault                         {Add-AzKeyVaultCertificate, Update-AzKeyVaultCer...
Script     1.3.2      Az.LogicApp                         {Get-AzIntegrationAccountAgreement, Get-AzIntegr...
Script     1.1.3      Az.MachineLearning                  {Move-AzMlCommitmentAssociation, Get-AzMlCommitm...
Script     1.0.0      Az.Maintenance                      {Get-AzApplyUpdate, Get-AzConfigurationAssignmen...
Script     1.0.2      Az.ManagedServices                  {Get-AzManagedServicesAssignment, New-AzManagedS...
Script     1.0.2      Az.MarketplaceOrdering              {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}   
Script     1.1.1      Az.Media                            {Sync-AzMediaServiceStorageKey, Set-AzMediaServi...
Script     2.0.1      Az.Monitor                          {Get-AzMetricDefinition, Get-AzMetric, Remove-Az...
Script     3.1.0      Az.Network                          {Add-AzApplicationGatewayAuthenticationCertifica...
Script     1.1.1      Az.NotificationHubs                 {Get-AzNotificationHub, Get-AzNotificationHubAut...
Script     2.2.0      Az.OperationalInsights              {New-AzOperationalInsightsAzureActivityLogDataSo...
Script     1.3.1      Az.PolicyInsights                   {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPol...
Script     1.1.2      Az.PowerBIEmbedded                  {Remove-AzPowerBIWorkspaceCollection, Get-AzPowe...
Script     1.0.3      Az.PrivateDns                       {Get-AzPrivateDnsZone, Remove-AzPrivateDnsZone, ...
Script     2.10.0     Az.RecoveryServices                 {Get-AzRecoveryServicesBackupProperty, Get-AzRec...
Script     1.2.1      Az.RedisCache                       {Remove-AzRedisCachePatchSchedule, New-AzRedisCa...
Script     1.0.3      Az.Relay                            {New-AzRelayNamespace, Get-AzRelayNamespace, Set...
Script     2.2.0      Az.Resources                        {Get-AzProviderOperation, Remove-AzRoleAssignmen...
Script     1.4.1      Az.ServiceBus                       {New-AzServiceBusNamespace, Get-AzServiceBusName...
Script     2.1.0      Az.ServiceFabric                    {Add-AzServiceFabricClientCertificate, Add-AzSer...
Script     1.1.1      Az.SignalR                          {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey,...
Script     2.8.0      Az.Sql                              {Get-AzSqlDatabaseTransparentDataEncryption, Get...
Script     1.1.0      Az.SqlVirtualMachine                {New-AzSqlVM, Get-AzSqlVM, Update-AzSqlVM, Remov...
Script     2.2.0      Az.Storage                          {Get-AzStorageAccount, Get-AzStorageAccountKey, ...
Script     1.2.3      Az.StorageSync                      {Invoke-AzStorageSyncCompatibilityCheck, New-AzS...
Script     1.0.1      Az.StreamAnalytics                  {Get-AzStreamAnalyticsFunction, Get-AzStreamAnal...
Script     1.0.0      Az.Support                          {Get-AzSupportService, Get-AzSupportProblemClass...
Script     1.0.4      Az.TrafficManager                   {Add-AzTrafficManagerCustomHeaderToEndpoint, Rem...
Script     1.10.0     Az.Websites                         {Get-AzAppServicePlan, Set-AzAppServicePlan, New...
Script     5.1.2      Azure                               {Get-AzureAutomationCertificate, Get-AzureAutoma...
Manifest   0.5.0      Azure.AnalysisServices              {Add-AzureAnalysisServicesAccount, Restart-Azure...
Script     4.2.1      Azure.Storage                       {Get-AzureStorageTable, New-AzureStorageTableSAS...
Binary     2.0.2.76   AzureAD                             {Add-AzureADApplicationOwner, Get-AzureADApplica...
Script     1.0.1      Microsoft.PowerShell.Operation.V... {Get-OperationValidation, Invoke-OperationValida...
Manifest   1.1.166.0  MSOnline                            {Get-MsolDevice, Remove-MsolDevice, Enable-MsolD...
Manifest   6.0.0.0    NetworkingDsc                                                                          
Script     4.2.4      NTFSSecurity                        {Add-NTFSAccess, Clear-NTFSAccess, Disable-NTFSA...
Script     1.1.7.2    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider,...
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider,...
Script     4.8.1      Pester                              {Describe, Context, It, Should...}                 
Script     3.4.0      Pester                              {Describe, Context, It, Should...}                 
Script     1.6.5      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Fi...
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Updat...
Manifest   2.9.0.0    PSDscResources                                                                         
Script     2.0.0      PSReadline                          {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHand...
Manifest   1.1.0.0    xRemoteDesktopAdmin                                                                    

    Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

ModuleType Version    Name                                ExportedCommands                                   
---------- -------    ----                                ----------------                                   
Manifest   1.0.0.0    AppBackgroundTask                   {Disable-AppBackgroundTaskDiagnosticLog, Enable-...
Manifest   2.0.0.0    AppLocker                           {Get-AppLockerFileInformation, Get-AppLockerPoli...
Manifest   1.0.0.0    AppvClient                          {Add-AppvClientConnectionGroup, Add-AppvClientPa...
Manifest   2.0.1.0    Appx                                {Add-AppxPackage, Get-AppxPackage, Get-AppxPacka...
Script     1.0.0.0    AssignedAccess                      {Clear-AssignedAccess, Get-AssignedAccess, Set-A...
Manifest   1.0.0.0    BitLocker                           {Unlock-BitLocker, Suspend-BitLocker, Resume-Bit...
Manifest   2.0.0.0    BitsTransfer                        {Add-BitsFile, Complete-BitsTransfer, Get-BitsTr...
Manifest   1.0.0.0    BranchCache                         {Add-BCDataCacheExtension, Clear-BCCache, Disabl...
Manifest   1.0.0.0    CimCmdlets                          {Get-CimAssociatedInstance, Get-CimClass, Get-Ci...
Manifest   1.0        ConfigCI                            {Get-SystemDriver, New-CIPolicyRule, New-CIPolic...
Manifest   1.0        ConfigDefender                      {Get-MpPreference, Set-MpPreference, Add-MpPrefe...
Manifest   1.0        Defender                            {Get-MpPreference, Set-MpPreference, Add-MpPrefe...
Manifest   1.0.2.0    DeliveryOptimization                {Delete-DeliveryOptimizationCache, Set-DeliveryO...
Manifest   1.0.0.0    DirectAccessClientComponents        {Disable-DAManualEntryPointSelection, Enable-DAM...
Script     3.0        Dism                                {Add-AppxProvisionedPackage, Add-WindowsDriver, ...
Manifest   1.0.0.0    DnsClient                           {Resolve-DnsName, Clear-DnsClientCache, Get-DnsC...
Manifest   1.0.0.0    EventTracingManagement              {Start-EtwTraceSession, New-EtwTraceSession, Get...
Manifest   1.0.0.0    HgsClient                           {Get-HgsAttestationBaselinePolicy, Get-HgsClient...
Manifest   1.0.0.0    HgsDiagnostics                      {New-HgsTraceTarget, Get-HgsTrace, Get-HgsTraceF...
Binary     1.0.0.0    HostComputeService                  {Get-ComputeProcess, Stop-ComputeProcess}          
Manifest   1.0.0.1    HostNetworkingService               {Remove-HnsNamespace, Remove-HnsEndpoint, Get-Hn...
Binary     2.0.0.0    Hyper-V                             {Add-VMAssignableDevice, Add-VMDvdDrive, Add-VMF...
Binary     1.1        Hyper-V                             {Add-VMDvdDrive, Add-VMFibreChannelHba, Add-VMHa...
Manifest   2.0.0.0    International                       {Get-WinDefaultInputMethodOverride, Set-WinDefau...
Manifest   1.0.0.0    iSCSI                               {Get-IscsiTargetPortal, New-IscsiTargetPortal, R...
Script     1.0.0.0    ISE                                 {New-IseSnippet, Import-IseSnippet, Get-IseSnippet}
Manifest   1.0.0.0    Kds                                 {Add-KdsRootKey, Get-KdsRootKey, Test-KdsRootKey...
Manifest   1.0.1.0    Microsoft.PowerShell.Archive        {Compress-Archive, Expand-Archive}                 
Manifest   3.0.0.0    Microsoft.PowerShell.Diagnostics    {Get-WinEvent, Get-Counter, Import-Counter, Expo...
Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}                
Manifest   1.0.0.0    Microsoft.PowerShell.LocalAccounts  {Add-LocalGroupMember, Disable-LocalUser, Enable...
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-ItemProperty,...
Script     1.0        Microsoft.PowerShell.ODataUtils     Export-ODataEndpointProxy                          
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Crede...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Table, Forma...
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-...
Manifest   1.0        MMAgent                             {Disable-MMAgent, Enable-MMAgent, Set-MMAgent, G...
Manifest   1.0.0.0    MsDtc                               {New-DtcDiagnosticTransaction, Complete-DtcDiagn...
Manifest   2.0.0.0    NetAdapter                          {Disable-NetAdapter, Disable-NetAdapterBinding, ...
Manifest   1.0.0.0    NetConnection                       {Get-NetConnectionProfile, Set-NetConnectionProf...
Manifest   1.0.0.0    NetDiagnostics                      Get-NetView                                        
Manifest   1.0.0.0    NetEventPacketCapture               {New-NetEventSession, Remove-NetEventSession, Ge...
Manifest   2.0.0.0    NetLbfo                             {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-...
Manifest   1.0.0.0    NetNat                              {Get-NetNat, Get-NetNatExternalAddress, Get-NetN...
Manifest   2.0.0.0    NetQos                              {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQ...
Manifest   2.0.0.0    NetSecurity                         {Get-DAPolicyChange, New-NetIPsecAuthProposal, N...
Manifest   1.0.0.0    NetSwitchTeam                       {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-Ne...
Manifest   1.0.0.0    NetTCPIP                            {Get-NetIPAddress, Get-NetIPInterface, Get-NetIP...
Manifest   1.0.0.0    NetworkConnectivityStatus           {Get-DAConnectionStatus, Get-NCSIPolicyConfigura...
Manifest   1.0.0.0    NetworkSwitchManager                {Disable-NetworkSwitchEthernetPort, Enable-Netwo...
Manifest   1.0.0.0    NetworkTransition                   {Add-NetIPHttpsCertBinding, Disable-NetDnsTransi...
Manifest   1.0.0.0    PcsvDevice                          {Get-PcsvDevice, Start-PcsvDevice, Stop-PcsvDevi...
Binary     1.0.0.0    PersistentMemory                    {Get-PmemDisk, Get-PmemPhysicalDevice, Get-PmemU...
Manifest   1.0.0.0    PKI                                 {Add-CertificateEnrollmentPolicyServer, Export-C...
Manifest   1.0.0.0    PnpDevice                           {Get-PnpDevice, Get-PnpDeviceProperty, Enable-Pn...
Manifest   1.1        PrintManagement                     {Add-Printer, Add-PrinterDriver, Add-PrinterPort...
Binary     1.0.11     ProcessMitigations                  {Get-ProcessMitigation, Set-ProcessMitigation, C...
Script     3.0        Provisioning                        {Install-ProvisioningPackage, Export-Provisionin...
Manifest   1.1        PSDesiredStateConfiguration         {Set-DscLocalConfigurationManager, Start-DscConf...
Script     1.0.0.0    PSDiagnostics                       {Disable-PSTrace, Disable-PSWSManCombinedTrace, ...
Binary     1.1.0.0    PSScheduledJob                      {New-JobTrigger, Add-JobTrigger, Remove-JobTrigg...
Manifest   2.0.0.0    PSWorkflow                          {New-PSWorkflowExecutionOption, New-PSWorkflowSe...
Manifest   1.0.0.0    PSWorkflowUtility                   Invoke-AsWorkflow                                  
Manifest   1.0.0.0    ScheduledTasks                      {Get-ScheduledTask, Set-ScheduledTask, Register-...
Manifest   2.0.0.0    SecureBoot                          {Confirm-SecureBootUEFI, Set-SecureBootUEFI, Get...
Manifest   2.0.0.0    SmbShare                            {Get-SmbShare, Remove-SmbShare, Set-SmbShare, Bl...
Manifest   2.0.0.0    SmbWitness                          {Get-SmbWitnessClient, Move-SmbWitnessClient, gs...
Manifest   1.0.0.0    StartLayout                         {Export-StartLayout, Import-StartLayout, Export-...
Manifest   2.0.0.0    Storage                             {Add-InitiatorIdToMaskingSet, Add-PartitionAcces...
Manifest   1.0.0.0    StorageBusCache                     {Clear-StorageBusDisk, Disable-StorageBusCache, ...
Manifest   2.0.0.0    TLS                                 {New-TlsSessionTicketKey, Enable-TlsSessionTicke...
Manifest   1.0.0.0    TroubleshootingPack                 {Get-TroubleshootingPack, Invoke-Troubleshooting...
Manifest   2.0.0.0    TrustedPlatformModule               {Get-Tpm, Initialize-Tpm, Clear-Tpm, Unblock-Tpm...
Binary     2.1.639.0  UEV                                 {Clear-UevConfiguration, Clear-UevAppxPackage, R...
Manifest   2.0.0.0    VpnClient                           {Add-VpnConnection, Set-VpnConnection, Remove-Vp...
Manifest   1.0.0.0    Wdac                                {Get-OdbcDriver, Set-OdbcDriver, Get-OdbcDsn, Ad...
Manifest   2.0.0.0    Whea                                {Get-WheaMemoryPolicy, Set-WheaMemoryPolicy}       
Manifest   1.0.0.0    WindowsDeveloperLicense             {Get-WindowsDeveloperLicense, Unregister-Windows...
Script     1.0        WindowsErrorReporting               {Enable-WindowsErrorReporting, Disable-WindowsEr...
Manifest   1.0.0.0    WindowsSearch                       {Get-WindowsSearchSetting, Set-WindowsSearchSett...
Manifest   1.0.0.0    WindowsUpdate                       Get-WindowsUpdateLog                               
Manifest   1.0.0.2    WindowsUpdateProvider               {Get-WUAVersion, Get-WULastInstallationDate, Get...

    Directory: C:\Program Files (x86)\Microsoft Azure Information Protection\Powershell

ModuleType Version    Name                                ExportedCommands                                   
---------- -------    ----                                ----------------                                   
Binary     2.6.111.0  AzureInformationProtection          {Clear-AIPAuthentication, Get-AIPFileStatus, New...

Debug output

PS D:\Sources\DTL-VM-Generator> Get-AzureRmResource -resourcetype "Microsoft.DevTestLab/labs" -ApiVersion "2018-10-15-preview"
DEBUG: 4:03:15 PM - GetAzureResourceCmdlet begin processing with ParameterSet 'ByTagNameValueParameterSet'.
DEBUG: 4:03:15 PM - using account id 'phauge@microsoft.com'...
DEBUG: [Common.Authentication]: Authenticating using Account: 'phauge@microsoft.com', environment: 'AzureCloud
', tenant: '72f988bf-86f1-41af-91ab-2d7cd011db47'
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: '72f988bf-86f1-41af-91ab-2d
7cd011db47', Endpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2',
 ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri: 'https://management.core.windows.net/', Valid
ateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using context with Authority 'https://login.microsoftonline.co
m/72f988bf-86f1-41af-91ab-2d7cd011db47/', CorrelationId: '00000000-0000-0000-0000-000000000000', ValidateAutho
rity: 'True'
DEBUG: [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: '72f988bf-86f1-41af-91ab-
2d7cd011db47', AdEndpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945f
c2', ClientRedirectUri: urn:ietf:wg:oauth:2.0:oob
DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3627178Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs
: ADAL PCL.Desktop with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational versi
on '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...

DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3627178Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs
: ADAL PCL.Desktop with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational versi
on '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...

DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3627178Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs
: === Token Acquisition started: 
    CacheType: null
    Authentication Target: User
    , Authority Host: login.microsoftonline.com

DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3627178Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs
: === Token Acquisition started:
    Authority: https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/
    Resource: https://management.core.windows.net/
    ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
    CacheType: null
    Authentication Target: User

DEBUG: [ADAL]: Verbose: 2020-06-27T20:03:15.3627178Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs: Lo
ading from cache.

DEBUG: [ADAL]: Verbose: 2020-06-27T20:03:15.3627178Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs: Lo
ading from cache.

DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3687148Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs
: Deserialized 5 items to token cache.

DEBUG: [ADAL]: Verbose: 2020-06-27T20:03:15.3687148Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs: Lo
oking up cache for a token...

DEBUG: [ADAL]: Verbose: 2020-06-27T20:03:15.3687148Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs: Lo
oking up cache for a token...

DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3687148Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs
: An item matching the requested resource was found in the cache

DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3687148Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs
: An item matching the requested resource was found in the cache

DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3687148Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs
: 23.2455380866667 minutes left until token in cache expires

DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3687148Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs
: 23.2455380866667 minutes left until token in cache expires

DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3687148Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs
: A matching item (access token or refresh token or both) was found in the cache

DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3687148Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs
: A matching item (access token or refresh token or both) was found in the cache

DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3687148Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs
: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 6/27/2020 8:26:3
0 PM +00:00

DEBUG: [ADAL]: Information: 2020-06-27T20:03:15.3687148Z: f6488265-3d9a-4cc6-9fec-e47addf080cf - LoggerBase.cs
: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 6/27/2020 8:26:3
0 PM +00:00Access Token Hash: mXEUk7T6O8rhSb4neAGPS6kNUUnJgvZ8lQ9CvOscMcU=
     User id: a59b9299-9c4f-4e27-89b6-44d28baa270a

DEBUG: [Common.Authentication]: Renewing Token with Type: 'Bearer', Expiry: '06/27/2020 20:26:30 +00:00', Mult
ipleResource? 'True', Tenant: '72f988bf-86f1-41af-91ab-2d7cd011db47', UserId: 'phauge@microsoft.com'
DEBUG: [Common.Authentication]: User info for token DisplayId: 'phauge@microsoft.com', Name: Peter Hauge, IdPr
ovider: 'https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/', Uid: 'a59b9299-9c4f-4e27-89b6-44d28ba
a270a'
DEBUG: [Common.Authentication]: Checking token expiration, token expires '06/27/2020 20:26:30 +00:00' Comparin
g to '06/27/2020 20:03:15 +00:00' With threshold '00:05:00', calculated time until token expiry: '00:23:14.732
2852'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/39df6a21-006d-4800-a958-2280925030cb/resources?$filter=resourceType
 EQ 'Microsoft.DevTestLab/labs'&api-version=2018-10-15-preview

Headers:
User-Agent                    : PSVersion/v5.1.19041.1,pid-bd1d84d0-5ddb-4ab9-b951-393e656bb054,AzurePowershel
l/v1.0.0
ParameterSetName              : ByTagNameValueParameterSet
CommandName                   : Get-AzResource

Body:

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
x-ms-failure-cause            : gateway
x-ms-request-id               : d4708f07-48a8-4a0b-a2e2-c2dbf36d075f
x-ms-correlation-request-id   : d4708f07-48a8-4a0b-a2e2-c2dbf36d075f
x-ms-routing-request-id       : CENTRALUS:20200627T200315Z:d4708f07-48a8-4a0b-a2e2-c2dbf36d075f
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Cache-Control                 : no-cache
Date                          : Sat, 27 Jun 2020 20:03:15 GMT

Body:
{
  "error": {
    "code": "InvalidApiVersionParameter",
    "message": "The api-version '2018-10-15-preview' is invalid. The supported versions are '2020-06-01,2020-0
5-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-0
3-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-0
8-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-0
1-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'."
  }
}

Get-AzureRmResource : InvalidApiVersionParameter : The api-version '2018-10-15-preview' is invalid. The 
supported versions are '2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-
01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05
-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-0
7-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-
26,2014-04'.
CorrelationId: d4708f07-48a8-4a0b-a2e2-c2dbf36d075f
At line:1 char:1
+ Get-AzureRmResource -resourcetype "Microsoft.DevTestLab/labs" -ApiVer ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzResource], ErrorResponseMessageException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.GetAzureResour 
   ceCmdlet

DEBUG: AzureQoSEvent: CommandName - Get-AzResource; IsSuccess - False; Duration - 00:00:00.4728459;; Exception
 - Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.ErrorResponses.ErrorResponseMessageException: Inv
alidApiVersionParameter : The api-version '2018-10-15-preview' is invalid. The supported versions are '2020-06
-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05
-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12
-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11
-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.
CorrelationId: d4708f07-48a8-4a0b-a2e2-c2dbf36d075f
   at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletBase.HandleExceptio
n(ExceptionDispatchInfo capturedException)
   at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletBase.ExecuteCmdlet(
)
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 4:03:16 PM - GetAzureResourceCmdlet end processing.

Error output

PS C:\Users\phauge> Resolve-AzError
WARNING: Breaking changes in the cmdlet 'Resolve-AzError' :
WARNING:  - The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use
 this alias to use `Resolve-AzError` instead.

WARNING: NOTE : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, a
nd other information on breaking changes in Azure PowerShell.

   HistoryId: 1

Message        : InvalidApiVersionParameter : The api-version '2018-10-15-preview' is invalid. The supported 
                 versions are '2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2
                 019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-
                 07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-1
                 0,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,20
                 14-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.
                 CorrelationId: a1f76690-c8d6-47b3-a80b-07fd937b6a46
StackTrace     :    at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletB
                 ase.HandleException(ExceptionDispatchInfo capturedException)
                    at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletB
                 ase.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.ErrorResponses.ErrorResponseMessag
                 eException
InvocationInfo : {Get-AzResource}
Line           : Get-AzureRmResource -resourcetype "Microsoft.DevTestLab/labs" -ApiVersion 
                 "2018-10-15-preview"
Position       : At line:1 char:1
                 + Get-AzureRmResource -resourcetype "Microsoft.DevTestLab/labs" -ApiVer ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property 
                 for more information.
StackTrace     :    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
                    at System.Reflection.Assembly.GetTypes()
                    at Microsoft.PowerShell.Commands.AddTypeCommand.LoadAssemblyFromPathOrName(List`1 
                 generatedTypes)
                    at Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()
                    at System.Management.Automation.CommandProcessorBase.Complete()
Exception      : System.Reflection.ReflectionTypeLoadException
InvocationInfo : {Add-Type}
Line           :                 Add-Type -Path $_.FullName -ErrorAction Ignore | Out-Null

Position       : At 
                 C:\Users\phauge\Documents\WindowsPowerShell\Modules\Az.Accounts\1.8.0\Az.Accounts.psm1:68 
                 char:17
                 + ...                Add-Type -Path $_.FullName -ErrorAction Ignore | Out-N ...
                 +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property 
                 for more information.
StackTrace     :    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
                    at System.Reflection.Assembly.GetTypes()
                    at Microsoft.PowerShell.Commands.AddTypeCommand.LoadAssemblyFromPathOrName(List`1 
                 generatedTypes)
                    at Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()
                    at System.Management.Automation.CommandProcessorBase.Complete()
Exception      : System.Reflection.ReflectionTypeLoadException
InvocationInfo : {Add-Type}
Line           :                 Add-Type -Path $_.FullName -ErrorAction Ignore | Out-Null

Position       : At 
                 C:\Users\phauge\Documents\WindowsPowerShell\Modules\Az.Accounts\1.8.0\Az.Accounts.psm1:68 
                 char:17
                 + ...                Add-Type -Path $_.FullName -ErrorAction Ignore | Out-N ...
                 +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property 
                 for more information.
StackTrace     :    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
                    at System.Reflection.Assembly.GetTypes()
                    at Microsoft.PowerShell.Commands.AddTypeCommand.LoadAssemblyFromPathOrName(List`1 
                 generatedTypes)
                    at Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()
                    at System.Management.Automation.CommandProcessorBase.Complete()
Exception      : System.Reflection.ReflectionTypeLoadException
InvocationInfo : {Add-Type}
Line           :                 Add-Type -Path $_.FullName -ErrorAction Ignore | Out-Null

Position       : At 
                 C:\Users\phauge\Documents\WindowsPowerShell\Modules\Az.Accounts\1.8.0\Az.Accounts.psm1:68 
                 char:17
                 + ...                Add-Type -Path $_.FullName -ErrorAction Ignore | Out-N ...
                 +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=E
RROR.
petehauge commented 4 years ago

Quick update - I tried to go back to prior versions of PowerShell and didn't find a working version, all the way back to 1.8.0 unfortunately. I'm not sure if the APIs in Azure changed, but I wanted to add this in as extra information.

ghost commented 4 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure.

VeryEarly commented 4 years ago

Hi @petehauge ,

Thanks for reporting this issue, forwarded to ARM team.

petehauge commented 4 years ago

Ok, thanks forwarding the feedback! I'm doing more digging on my side and I found a workaround in our library code... So it's OK if this behavior is going to stay. I'm also not 100% sure that this is a regression - it might be our fault in our code that things are failing - I haven't been able to narrow that part down. Just wanted to let you know, Thanks!!