powershell - 术语 'New-AzureRmUserAssignedIdentity' 未被识别为名称

标签 powershell azure-powershell powershell-module azure-managed-identity azure-rm

我正在尝试创建用户分配的身份,文档说 6.13 应该包括这个功能:https://learn.microsoft.com/en-us/powershell/module/azurerm.managedserviceidentity/new-azurermuserassignedidentity?view=azurermps-6.13.0

我卸载了旧版本的 Azure RM 并安装了最新版本:

PS C:\Users\user> Get-Module AzureRM -ListAvailable | Select-Object -Property Name,Version,Path

Name    Version Path
----    ------- ----
AzureRM 6.13.1  C:\Program Files\WindowsPowerShell\Modules\AzureRM\6.13.1\AzureRM.psd1

但是当我尝试使用它时,出现以下错误:

PS C:\Users\zakima> New-AzureRmUserAssignedIdentity -ResourceGroupName PSRG -Name ID1
New-AzureRmUserAssignedIdentity : The term 'New-AzureRmUserAssignedIdentity' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:1
+ New-AzureRmUserAssignedIdentity -ResourceGroupName PSRG -Name ID1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (New-AzureRmUserAssignedIdentity:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我是否缺少某些配置设置?

最佳答案

New-AzureRmUserAssignedIdentity Cmdlet 位于 AzureRM.ManagedServiceIdentity 模块中。该模块又可以在 PowerShell Gallery 中找到并且可以通过以下方式安装:

Install-Module -Name "AzureRM.ManagedServiceIdentity" -AllowPrerelease

请注意,Install-ModuleAllowPrerelease 标志可能不适用于您安装的 PowerShellGet 版本,因此您可能需要更新它在上述工作之前:

Install-Module "PowerShellGet" –Repository "PSGallery" –Force

关于powershell - 术语 'New-AzureRmUserAssignedIdentity' 未被识别为名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54706538/

相关文章:

powershell - Invoke-RestMethod REST API PUT 方法

powershell - 如何读取 SNMP OID 输出(位)

powershell - Powershell-需要将ProxyAdresses中所有AD组中所有用户的smtp地址拉到单个列中

powershell - 更新 Azure Powershell 模块后,无法再导入我的模块并出现奇怪的错误

azure - 通过 ARM 启用 Azure SQL 数据库自动调整

powershell - 在哪里可以找到二进制 DSC 资源的 dll?

powershell - 如何在没有标签的情况下查询订阅中的所有虚拟机

PowerShell项目,将全局设置放在哪里?

Powershell不从模块导入函数

powershell - 通过 Powershell 从应用程序服务中删除自定义域/主机