Azure cli表示未在命名空间中注册

时间:2016-08-31 06:03:58

标签: macos azure azure-cli

我可以使用Web门户在Azure中创建Linux VM,并且很高兴SSH,但是我已经搜索了文档并且无法组装可以工作的CLI命令,例如:

$ azure vm quick-create -M newkey.pub -g myresgrp -Q CoreOS --name gaiusvm1 -u gaius -l westeurope -y Linux

这失败了:

error:   The subscription is not registered to use namespace 'Microsoft.Compute'. See https://aka.ms/rps-not-found for how to register subscriptions.
error:   Error information has been recorded to /Users/gaius/.azure/azure.err
error:   vm quick-create command failed

我已经确认我的CLI与azure account list看到的订阅是Web门户也看到的即付即用。

根据我所犯错误页面上的说明:

$ azure provider register Microsoft.Compute

哪个失败了:

error:   Namespace Microsoft.Compute Registration took too long to complete
error:   Error information has been recorded to /Users/gaius/.azure/azure.err
error:   provider register command failed

什么是CLI与门户网站的不同之处,我假设他们实际上是在调用相同的服务,我怎么能在这个和任何其他命名空间中注册?

1 个答案:

答案 0 :(得分:2)

使用新订阅时会出现此错误。解决此问题的最简单方法是在Azure门户中创建ARM虚拟机,门户网站将为您注册Microsoft.Compute

如果您使用azure provider register Microsoft.Compute注册命名空间,则可能会收到错误消息,指出"注册花费的时间太长而无法完成#34;。这是因为注册确实需要一些时间,Azure CLI的超时时间太短。但是,不要担心。命名空间最终将在几分钟内注册。并且,您可以使用以下命令检查注册状态。

azure provider show Microsoft.Compute

你会看到类似的东西。

info:    Executing command provider show
+ Getting provider information
data:    Namespace: Microsoft.Compute
data:    Registration state: Registering
....

几分钟后,当注册状态变为已注册时,您将能够使用Azure CLI创建ARM虚拟机。