【问题标题】:Using ansible to create Azure resource group, throws "403 client error"使用 ansible 创建 Azure 资源组,抛出“403 客户端错误”
【发布时间】:2019-02-22 08:19:00
【问题描述】:

现在我正在使用 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-version=2017-05-10"}

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

【问题讨论】:

  • 您是否授予了服务主体权限?另外,你是如何安装ansible的?这看起来不像天蓝色方面的权限错误
  • 您的服务主体似乎没有创建资源组的权限。尝试:在门户中导航到您的订阅 -> Access control (IAM) -> Add -> Add role assignment -> 将您的服务主体添加为订阅中的角色(例如所有者)。
  • 谢谢@JoyWang,我会试试的。
  • @JoyWang 不,这个错误看起来根本不像
  • @4c74356b41 感谢您的帮助。我已经尝试过 Joy 之前所说的,现在看来效果很好……我应该将服务主体添加到订阅中。

标签: azure ansible


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

    对于可能出现此错误的其他人,请确保还检查您当前的订阅是否未按量付费,因为您会看到相同的错误:

    FAILED! => {"changed": false, "msg": "Error checking for existence of name * - 403 Client Error: Forbidden for url: https://management.azure.com/subscriptions/*/resourcegroups/rg-cs-ansible?api-version=2017-05-10"}
    

    See screenshot sample as seen in azure

    【讨论】:

      猜你喜欢
      • 2017-12-13
      • 1970-01-01
      • 2020-11-20
      • 2010-12-24
      • 2021-04-07
      • 1970-01-01
      • 2022-09-27
      • 2020-11-18
      • 1970-01-01
      相关资源
      最近更新 更多