g.pickardou
g.pickardou

Reputation: 35973

How to use AzureRm module with PowerShell 7?

Context

I've just installed PowerShell 7. I am trying to run my working tested Azure related scripts... So I installed and imported AzureAd and AzureRM modules.

When trying to log in either Connect-AzureAD or Connect-AzureRmAccountboth gave me the following error (keep reading)

Could not load type 'System.Security.Cryptography.SHA256Cng'

OK, this is because the Azure Modules are looking for that API, which is not available in .NET Core, so I used the Import-Module with the -UseWindowsPowerShell parameter, which solved the issue but only for the AzureAD module

Question

For the command Import-Module AzureRm -UseWindowsPowerShell I got the following error message:

Import-Module: Failed to generate proxies for remote module 'AzureRM'. Running the Get-Command command in a remote session returned no results.

So I still can not use Connect-AzureRmAccount Any ideas?

Upvotes: 5

Views: 7104

Answers (1)

Joy Wang
Joy Wang

Reputation: 42163

The AzureRm is incompatible with PowerShell 7, and it has been deprecated and will not be updated.

Your option is to use the Az module, just uninstall the AzureRm module and install the Az module.

Install-Module -Name Az -Force

Fore more details, see Introducing the new Azure PowerShell Az module.

Then use the Connect-AzAccount to login, if you don't want to change your existing script which uses AzureRm command, just use Enable-AzureRmAlias before all the commands.

Upvotes: 9

Related Questions