首页 > 解决方案 > 使用 ansible 创建 Azure 资源组,抛出“403 客户端错误”

问题描述

现在我正在使用 ansible playbooks 在 Centos 7.0 上创建 azure 资源组,我创建了一个这样的凭证文件:

[default]
subscription_id=my_subscription_id
client_id=<the application ID>
secret=<the password>
tenant=<my aad id>

它会抛出这样的错误:

{“changed”:false,“msg”:“检查名称 ansible-rg 是否存在时出错 - 403 客户端错误:禁止 url:https://management.azure.com/subscriptions/my_subscription_id/resourcegroups/ansible-rg? api版本=2017-05-10 “}

我知道可能是因为我没有订阅许可,但我不确定我应该怎么做。

标签: azureansible

解决方案


似乎您的服务主体没有创建资源组的权限。

尝试:在门户中导航到您的订阅 -> Access control (IAM)-> Add-> Add role assignment-> 将您的服务主体添加为订阅中的角色(例如所有者)。


推荐阅读