术语 'Set-AzureKeyVaultKeyAttributes' 未被识别为 cmdlet 的名称,

The term 'Set-AzureKeyVaultKeyAttributes' is not recognized as the name of a cmdlet,

在我的 Windows 10 上,我已经 Powershell 5.0 安装了。但是当我运行上面的命令时,我得到了上面的错误。

PS 命令:

Set-AzureKeyVaultKeyAttributes -Name Key2 -VaultName KayVault-abctest -Enable $false

错误

Set-AzureKeyVaultKeyAttributes : The term 'Set-AzureKeyVaultKeyAttributes' 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 + Set-AzureKeyVaultKeyAttributes -Name Key2 -VaultName KayVault-abctest ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Set-AzureKeyVaultKeyAttributes:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

备注 我在本 official Azure lab 教程中使用了主题 Create a Key (Portal)

我认为 cmdlet 的名称应该是 Microsoft Powershell 的单数 Set-AzureKeyVaultKeyAttribute, rather than the plural Set-AzureKeyVaultKeyAttributes. Note that this is one of the Strongly Encouraged Development Guidelines

To enhance the user experience, the noun that you choose for a cmdlet name should be singular. For example, use the name Get-Process instead of Get-Processes. It is best to follow this rule for all cmdlet names, even when a cmdlet is likely to act upon more than one item.

如果您在使用单数名称时仍然遇到同样的问题,请确保安装并加载了 AzureRM.KeyVault 模块:

Install-Module AzureRM.KeyVault
Import-Module AzureRM.KeyVault