使用puppet模块创建azure vm

时间:2016-05-09 20:28:25

标签: azure virtual-machine puppet

当我想在azure上创建一个vm时,我得到以下错误:

无权执行操作' Microsoft.Storage/register/action'超范围

我在经典门户网站上创建了一个应用程序并遵循了本教程:

https://azure.microsoft.com/en-us/documentation/articles/resource-group-create-service-principal-portal/

之后,我在新门户上创建了一个资源组,并为此应用程序分配了所有者。

我使用这个木偶脚本来创建vm:

azure_vm { 'sample':
    ensure         => present,
    location       => 'westus',
    image          => 'canonical:ubuntuserver:14.04.2-LTS:latest',
    user           => 'azureuser',
    password       => 'Password',
    size           => 'Standard_A0',
    resource_group => 'puppettest123',
}

当我运行它时,我得到了这个确切的错误:

Error: {"error"=>{"code"=>"AuthorizationFailed", "message"=>"The client '5b0bc6d-fcad-4223-8527-a2c9afc2661' with object id '5b0bc6d-fcad-4223-8527-a2c9afc2661' does not have authorization to perform action 'Microsoft.Storage/register/action' over scope '/subscriptions/5ad96a9-45de-4fe1-91e8-2514dd5e6a9'."}}
Error: /Stage[main]/Main/Azure_vm[sample]/ensure: change from absent to present failed: {"error"=>{"code"=>"AuthorizationFailed", "message"=>"The client '5b0bc6d-fcad-4223-8527-a2c9afc2661' with object id '5b0bc6d-fcad-4223-8527-a2c9afc2661' does not have authorization to perform action 'Microsoft.Storage/register/action' over scope '/subscriptions/5ad96a9-45de-4fe1-91e8-2514dd5e6a9'."}}

https://forge.puppet.com/puppetlabs/azure

关于我如何解决这个问题的任何想法?

我使用此命令解决了问题: azure role assignment create --objectId 7dbc8265-51ed-4038-8e13-31948c7f4ce7 -o Owner -c / subscriptions / {subscriptionId} /

1 个答案:

答案 0 :(得分:0)

azure role assignment create --objectId 7dbc8265-51ed-4038-8e13-31948c7f4ce7 -o Owner -c / subscriptions / {subscriptionId} /