-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Description
If you install both the “Azure” and the “AzureRM” modules, when using "Azure" module cmdlets you receive warnings about “AzureRM” module retirement:
'Because the Az modules have all the capabilities of AzureRM modules and more, we will retire the AzureRM modules on 29 February 2024. Learn more about the migration to Az: http://aka.ms/azpsmigrate.'
The “Azure” and “AzureRM” PowerShell modules comes with their own copies of an internal library called Microsoft.WindowsAzure.Commands.Common.dll. This library contains various infrastructure-logic and it’s this library which produce the retirement-warning. There appears to be an issue with the DLL search order when this library is loaded - when you are using the Azure module, the AzureRM-copy of this library is loaded.
Reproducing the issue:
- Create a new Azure Virtual Machine of type Windows Server 2022 Datacenter Azure Edition.
- Log on to the VM.
- Run the PowerShell command “Install-Module Azure” to install the Azure module.
- Run the PowerShell command “Install-Module AzureRM” to install the AzureRM module.
- Open a new PowerShell prompt and run the command Get-AzureDeployment. (This command is part of the “Azure” module)
- When prompted for service name, enter an arbitrary string.
Issue script & Debug output
PS C:\Windows\system32> get-azuredeployment
cmdlet Get-AzureDeployment at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
ServiceName: test
DEBUG: 8:38:06 AM - GetAzureDeploymentCommand begin processing with ParameterSet '__AllParameterSets'.
WARNING: Because the Az modules have all the capabilities of AzureRM modules and more, we will retire the AzureRM
modules on 29 February 2024. Learn more about the migration to Az: http://aka.ms/azpsmigrate.
get-azuredeployment : No default subscription has been designated. Use Select-AzureSubscription -Default
<subscriptionName> to set the default subscription.
At line:1 char:1
+ get-azuredeployment
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureDeployment], ApplicationException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.GetAzureDeploymentComma
nd
DEBUG: AzureQoSEvent: CommandName - Get-AzureDeployment; IsSuccess - False; Duration - 00:00:00.1488013; Exception -
System.ApplicationException: No default subscription has been designated. Use Select-AzureSubscription -Default
<subscriptionName> to set the default subscription.
at
Microsoft.Azure.Commands.Common.Authentication.Factories.ClientFactory.CreateClient[TClient](IAzureContextContainer
profile, IAzureSubscription subscription, String endpoint)
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at
Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.GetAzureDeploymentCommand.<OnProcessRecord>b__8_0()
at
Microsoft.WindowsAzure.Commands.Utilities.Common.ServiceManagementBaseCmdlet.ExecuteClientActionNewSM[TResult](Object
input, String operationDescription, Func`1 action, Func`3 contextFactory);
DEBUG: Finish sending metric.
DEBUG: 8:38:07 AM - GetAzureDeploymentCommand end processing.
DEBUG: 8:38:07 AM - GetAzureDeploymentCommand end processing.
Environment data
Name Value
---- -----
PSVersion 5.1.22000.2538
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22000.2538
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Module versions
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 5.8.4 AzureRM.Profile {Add-AzureRmEnvironment, Clear-AzureRmContext, Clear-Azure...
Error output
PS C:\Windows\system32> resolve-azurermerror
DEBUG: 8:39:57 AM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
WARNING: Because the Az modules have all the capabilities of AzureRM modules and more, we will retire the AzureRM
modules on 29 February 2024. Learn more about the migration to Az: http://aka.ms/azpsmigrate.
HistoryId: 5
Message : No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName>
to set the default subscription.
StackTrace : at Microsoft.Azure.Commands.Common.Authentication.Factories.ClientFactory.CreateClient[TClient](IAz
ureContextContainer profile, IAzureSubscription subscription, String endpoint)
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.GetAzureDeploymentCommand.<OnPr
ocessRecord>b__8_0()
at Microsoft.WindowsAzure.Commands.Utilities.Common.ServiceManagementBaseCmdlet.ExecuteClientAction
NewSM[TResult](Object input, String operationDescription, Func`1 action, Func`3 contextFactory)
Exception : System.ApplicationException
InvocationInfo : {Get-AzureDeployment}
Line : get-azuredeployment -debug
Position : At line:1 char:1
+ get-azuredeployment -debug
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 5
HistoryId: 4
Message : No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName>
to set the default subscription.
StackTrace : at Microsoft.Azure.Commands.Common.Authentication.Factories.ClientFactory.CreateClient[TClient](IAz
ureContextContainer profile, IAzureSubscription subscription, String endpoint)
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.GetAzureDeploymentCommand.<OnPr
ocessRecord>b__8_0()
at Microsoft.WindowsAzure.Commands.Utilities.Common.ServiceManagementBaseCmdlet.ExecuteClientAction
NewSM[TResult](Object input, String operationDescription, Func`1 action, Func`3 contextFactory)
Exception : System.ApplicationException
InvocationInfo : {Get-AzureDeployment}
Line : get-azuredeployment
Position : At line:1 char:1
+ get-azuredeployment
+ ~~~~~~~~~~~~~~~~~~~
HistoryId : 4
HistoryId: 1
Message : No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName>
to set the default subscription.
StackTrace : at Microsoft.Azure.Commands.Common.Authentication.Factories.ClientFactory.CreateClient[TClient](IAz
ureContextContainer profile, IAzureSubscription subscription, String endpoint)
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.GetAzureDeploymentCommand.<OnPr
ocessRecord>b__8_0()
at Microsoft.WindowsAzure.Commands.Utilities.Common.ServiceManagementBaseCmdlet.ExecuteClientAction
NewSM[TResult](Object input, String operationDescription, Func`1 action, Func`3 contextFactory)
Exception : System.ApplicationException
InvocationInfo : {Get-AzureDeployment}
Line : get-azuredeployment
Position : At line:1 char:1
+ get-azuredeployment
+ ~~~~~~~~~~~~~~~~~~~
HistoryId : 1
DEBUG: AzureQoSEvent: CommandName - Resolve-AzureRmError; IsSuccess - True; Duration - 00:00:00.1259005; Exception - ;
DEBUG: Finish sending metric.
DEBUG: 8:39:57 AM - ResolveError end processing.
DEBUG: 8:39:57 AM - ResolveError end processing.