gpt4 book ai didi

powershell - 如何在 PowerShell 7 中使用 AzureRm 模块?

转载 作者:行者123 更新时间:2023-12-03 00:57:12 25 4
gpt4 key购买 nike

上下文

我刚刚安装了 PowerShell 7。我正在尝试运行经过测试的 Azure 相关脚本...所以我安装并导入了 AzureAd 和 AzureRM 模块。

尝试登录 Connect-AzureADConnect-AzureRmAccount 时都出现以下错误(继续阅读)

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

好的,这是因为 Azure 模块正在寻找 .NET Core 中不可用的 API,所以我使用了 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 - 如何在 PowerShell 7 中使用 AzureRm 模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61184656/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com