【问题标题】:Where can I find a list of azure identity scopes and their permission levels?在哪里可以找到 azure 身份范围及其权限级别的列表?
【发布时间】:2020-05-16 16:55:48
【问题描述】:

当...

  • 使用类似az ad sp create-for-rbac -n 'test' --sdk-auth 的东西创建一个新的服务主体

...那么...

  • 使用!az role assignment list --assignee 'serv_princ_obj_id' 列出新的服务主体属性
[
  {
    "canDelegate": null,
    "id": "/subscriptions/redact/providers/Microsoft.Authorization/roleAssignments/redact",
    "name": "redact",
    "principalId": "redact",
    "principalName": "http://test",
    "principalType": "ServicePrincipal",
    "roleDefinitionId": "/subscriptions/redact/providers/Microsoft.Authorization/roleDefinitions/redact",
    "roleDefinitionName": "Contributor",
    "scope": "/subscriptions/redact",
    "type": "Microsoft.Authorization/roleAssignments"
  }
]

...或分配系统分配的托管标识...

  • 使用az functionapp identity assign -g MyResourceGroup -n MyUniqueApp)...

通常有一个--scope 选项。我在任何地方都找不到这些范围和描述的列表。

寻找类似az account list-locations --query [].displayName 的东西,但用[].scopes 代替。

有人知道在哪里可以找到这些吗?

【问题讨论】:

    标签: azure scope azure-managed-identity


    【解决方案1】:

    在“az ad sp”命令中,“--scopes”参数指的是您要附加服务原则的目标资源(带有订阅、资源组详细信息)。

    例如:az ad sp create-for-rbac -n "test" --role 贡献者 --scopes /subscriptions/{SubID}/resourceGroups/{ResourceGroupName}

    因此,范围列表意味着您需要列出您有权访问的订阅中的资源。下面的命令可能会有所帮助:

    az 资源列表 --subscription --resource-group

    请参考thisazure cli页面。

    【讨论】:

    • 对。那么--scopes 的所有选项是什么?选项在哪里描述?您发送的链接不包含字符串“范围”。其定义为:Space-separated list of scopes the service principal's role assignment applies to. Defaults to the root of the current subscription.
    • --scope 标志下的文档中找到了部分列表:docs.microsoft.com/en-us/cli/azure/role/…。我想理解的语法是.../myGroup/providers/Microsoft.Compute/virtualMachines/myVM。如果我想分配资源级范围,我怎么知道添加“提供者”“Microsoft.Compute/virtualMachines”?另外,顶级“订阅”范围提供了哪些权限?
    【解决方案2】:

    谢谢@megh-6789。为了扩展您的答案,在运行 az resource list --subscription $sub_id 之后,我可以看到资源的 id 与我正在寻找的 --scopes 语法匹配。

    示例:

    {
        "id": "/subscriptions/redact/resourceGroups/redact/providers/Microsoft.Maps/accounts/redact",
        "identity": null,
        "kind": null,
        "location": "global",
        "managedBy": null,
        "name": "redact",
        "plan": null,
        "properties": null,
        "resourceGroup": "redact",
        "sku": {
          "capacity": null,
          "family": null,
          "model": null,
          "name": "s1",
          "size": null,
          "tier": "Standard"
        },
        "tags": null,
        "type": "Microsoft.Maps/accounts"
      }
    

    似乎可以将scope 设置为订阅、资源组或资源级别。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-26
      • 2018-03-04
      • 2017-11-12
      • 1970-01-01
      相关资源
      最近更新 更多