如何在 PowerShell 7 中使用 AzureRm 模块?
How to use AzureRm module with PowerShell 7?
上下文
我刚刚安装了 PowerShell 7。我正在尝试 运行 我的工作测试 Azure 相关脚本...所以我安装并导入了 AzureAd 和 AzureRM 模块。
尝试登录 Connect-AzureAD
或 Connect-AzureRmAccount
时都出现以下错误(继续阅读)
Could not load type 'System.Security.Cryptography.SHA256Cng'
好的,这是因为 Azure 模块正在寻找 API,这在 .NET Core 中不可用,所以我使用 Import-Module
和 -UseWindowsPowerShell
参数,这解决了问题但仅适用于 AzureAD 模块
问题
对于命令 Import-Module AzureRm -UseWindowsPowerShell
我收到以下错误消息:
Import-Module: Failed to generate proxies for remote module 'AzureRM'. Running the Get-Command command in a remote session returned no results.
所以我还是不能用Connect-AzureRmAccount
有什么想法吗?
AzureRm
与 PowerShell 7 不兼容,已弃用且不会更新。
您的选择是使用Az
模块,只需卸载AzureRm
模块并安装Az
模块。
Install-Module -Name Az -Force
有关详细信息,请参阅 Introducing the new Azure PowerShell Az module。
然后使用Connect-AzAccount
登录,如果您不想更改使用AzureRm
命令的现有脚本,只需在所有命令之前使用Enable-AzureRmAlias
即可。
上下文
我刚刚安装了 PowerShell 7。我正在尝试 运行 我的工作测试 Azure 相关脚本...所以我安装并导入了 AzureAd 和 AzureRM 模块。
尝试登录 Connect-AzureAD
或 Connect-AzureRmAccount
时都出现以下错误(继续阅读)
Could not load type 'System.Security.Cryptography.SHA256Cng'
好的,这是因为 Azure 模块正在寻找 API,这在 .NET Core 中不可用,所以我使用 Import-Module
和 -UseWindowsPowerShell
参数,这解决了问题但仅适用于 AzureAD 模块
问题
对于命令 Import-Module AzureRm -UseWindowsPowerShell
我收到以下错误消息:
Import-Module: Failed to generate proxies for remote module 'AzureRM'. Running the Get-Command command in a remote session returned no results.
所以我还是不能用Connect-AzureRmAccount
有什么想法吗?
AzureRm
与 PowerShell 7 不兼容,已弃用且不会更新。
您的选择是使用Az
模块,只需卸载AzureRm
模块并安装Az
模块。
Install-Module -Name Az -Force
有关详细信息,请参阅 Introducing the new Azure PowerShell Az module。
然后使用Connect-AzAccount
登录,如果您不想更改使用AzureRm
命令的现有脚本,只需在所有命令之前使用Enable-AzureRmAlias
即可。