【问题标题】:Can't use azure key vault ('New-AzureKeyVault' is not recognized) ('keyvault' is not an azure command)无法使用 azure key vault('New-AzureKeyVault' 无法识别)('keyvault' 不是 azure 命令)
【发布时间】:2020-09-05 03:13:20
【问题描述】:

我正在尝试创建 Azure Key Vault,但门户(旧的和新的)还没有选项,最新的文档说使用命令行,但这似乎也不起作用。

从 Azure CLI 运行时的未知命令:

C:\WINDOWS\system32>azure keyvault create --vault-name 'abc' --resource-group 'abc' --location 'West US'
error:   'keyvault' is not an azure command. See 'azure help'.

从 Azure PowerShell 运行时的未知命令:

PS C:\> New-AzureKeyVault -VaultName  -EnabledForDeployment -ResourceGroupName abc -Location "West US" -Sku "Premium"
New-AzureKeyVault : The term 'New-AzureKeyVault' 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-AzureKeyVault -VaultName  -EnabledForDeployment -ResourceGroupName ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (New-AzureKeyVault:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

如何使用 Key Vault?

编辑:

这些应该包含在 0.9.5 的 Azure CLI 中,但 0.9.9 没有: http://blogs.technet.com/b/kv/archive/2015/06/24/keyvaulthasshipped.aspx

C:\WINDOWS\system32>azure help
info:    Executing command help
info:             _    _____   _ ___ ___
info:            /_\  |_  / | | | _ \ __|
info:      _ ___/ _ \__/ /| |_| |   / _|___ _ _
info:    (___  /_/ \_\/___|\___/|_|_\___| _____)
info:       (_______ _ _)         _ ______ _)_ _
info:              (______________ _ )   (___ _ _)
info:
info:    Microsoft Azure: Microsoft's Cloud Platform
info:
info:    Tool version 0.9.9

【问题讨论】:

    标签: azure azure-keyvault


    【解决方案1】:

    如果首先发出以下命令,显然 Azure PowerShell 将起作用:

    Switch-AzureMode -Name AzureResourceManager
    

    我很困惑,因为文档说它已过时,并且在 10 月 1 日(距撰写本文后两天)之后可能无法使用。 https://github.com/Azure/azure-powershell/wiki/Deprecation-of-Switch-AzureMode-in-Azure-PowerShell

    仍然不知道为什么 Azure CLI 不工作,但至少它在某个地方工作。

    【讨论】:

    • 在 CLI 中也是一样的。使用azure config mode arm 就可以了。
    猜你喜欢
    • 2022-01-22
    • 1970-01-01
    • 1970-01-01
    • 2018-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-28
    • 2021-05-17
    相关资源
    最近更新 更多