创建新 KeyVault 时出现以下错误

The subscription is not registered to use namespace 'Microsoft.KeyVault'

对于所有其他产品,解决方案是使用 GUI 在同一区域/帐户中部署类似的资源,但是 KeyVault 在门户中尚不可用。 (经典或预览)

我按照说明操作 create a KeyVault are here 。如果这很重要,我只是碰巧在 OSX 上,但 NPM 适用于所有平台。
Chris$ sudo npm install azure-cli -g
Chris$ echo '. <(azure --completion)' >> .zshrc
Chris$ echo 'source ~/azure.completion.sh' >> ~/.bash_profile


Chris$ azure login -u [email protected]
Chris$ azure telemetry --enable
Chris$ azure config mode arm
Chris$ azure location list
Chris$ azure group create 'agent77keysRM' 'centralus'
Chris$ azure account list
Chris$ azure account set "AccountDisplayName"


Chris$ azure keyvault create --vault-name "agent77keys" --resource-group 'agent77keysRM' --location 'centralus'
info:    Executing command keyvault create
+ Checking pre-condition
+ Creating vault agent77keys
error:   The subscription is not registered to use namespace 'Microsoft.KeyVault'.
error:   Error information has been recorded to /Users/Chris/.azure/azure.err
error:   keyvault create command failed

出于隐私原因,我不会在这里倾倒 azure.err,但关键信息是:
   'x-ms-client-request-id': 'b9991d6f-bd8c-4e62-b887-cac9b90d0281',
    'accept-language': 'en-US',
    'Content-Type': 'application/json; charset=utf-8',
    'user-agent': 'WindowsAzureXplatCLI/0.10.2'
    ...
    'x-ms-failure-cause': 'gateway',
    'x-ms-request-id': 'fcb04d40-306f-40bd-b8df-f1b42b283010',
    'x-ms-correlation-request-id': 'fcb04d40-306f-40bd-b8df-f1b42b283010',
    'x-ms-routing-request-id': 'EASTUS:20160806T013209Z:fcb04d40-306f-40bd-b8df-f1b42b283010',

看起来注册修复了它,如果有人想看到它告诉您未创建 HSM key ,这里是输出......简单修复,只需添加 SKU
info:    Executing command keyvault create
+ Checking pre-condition
+ Creating vault xxxxx
info:    Created vault xxxxx
data:    id "/subscriptions/xxxx/resourceGroups/xxxx/providers/Microsoft.KeyVault/vaults/xxxxxxs"
data:    name "xxxx"
data:    type "Microsoft.KeyVault/vaults"
data:    location "centralus"
data:    properties sku family "A"
data:    properties sku name "Standard"
data:    properties tenantId "xxxx"
data:    properties accessPolicies 0 tenantId "xxxx
data:    properties accessPolicies 0 objectId "xxxx
data:    properties accessPolicies 0 permissions keys 0 "get"
data:    properties accessPolicies 0 permissions keys 1 "create"
data:    properties accessPolicies 0 permissions keys 2 "delete"
data:    properties accessPolicies 0 permissions keys 3 "list"
data:    properties accessPolicies 0 permissions keys 4 "update"
data:    properties accessPolicies 0 permissions keys 5 "import"
data:    properties accessPolicies 0 permissions keys 6 "backup"
data:    properties accessPolicies 0 permissions keys 7 "restore"
data:    properties accessPolicies 0 permissions secrets 0 "all"
data:    properties enabledForDeployment false
data:    properties vaultUri "https://xxxxx.vault.azure.net"
warn:    This vault does not support HSM-protected keys. Please refer to http://go.microsoft.com/fwlink/?linkid=512521 for the vault service tiers.
warn:    When creating a vault, specify the --sku parameter to select a service tier that supports HSM-protected keys.
info:    keyvault create command OK

最佳答案

请参阅此线程以了解您收到此错误的原因: The subscription is not registered to use namespace 'Microsoft.DataFactory error

要解决此问题,您需要向 Microsoft.KeyVault 资源提供程序注册您的订阅。您可以使用以下命令执行相同操作:

azure provider register --namespace "Microsoft.KeyVault"

使用 Azure 资源管理器
Register-AzureRmResourceProvider -ProviderNamespace 'Microsoft.KeyVault'

关于Azure Keyvault CLI 错误 : The subscription is not registered to use namespace 'Microsoft.KeyVault' ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38799788/

10-12 22:24