1

我可以使用 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 与门户有何不同,我假设他们实际上会在幕后调用相同的服务,我如何在此名称空间和任何其他名称空间中注册?

4

1 回答 1

2

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

如果您使用azure provider register Microsoft.Compute注册命名空间,您可能会收到一条错误消息,提示“注册时间太长无法完成”。这是因为注册确实需要一些时间,而且 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 虚拟机。

于 2016-09-01T00:48:34.187 回答