最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to get Role Definition using Azure CLI - Stack Overflow

programmeradmin3浏览0评论

I am using the below commands to get the role definition details

az role definition list --name "Storage Blob Data Owner"
Or
az role definition list --name "b7e6dc6d-f1e8-4753-8033-0f276bb0955b"

And it is working fine however for other roles like readerRoleId 00000000-0000-0000-0000-000000000001 it does not work and returns empty.

What command should I use instead?

I am using the below commands to get the role definition details

az role definition list --name "Storage Blob Data Owner"
Or
az role definition list --name "b7e6dc6d-f1e8-4753-8033-0f276bb0955b"

And it is working fine however for other roles like readerRoleId 00000000-0000-0000-0000-000000000001 it does not work and returns empty.

What command should I use instead?

Share Improve this question asked Mar 14 at 18:12 JimmyJimmy 317 bronze badges 3
  • Could you confirm whether your requirement is to fetch role with id 00000000-0000-0000-0000-000000000001 via CLI? – Sridevi Commented Mar 15 at 3:34
  • Yes, we store the all the roles as GUID in one column and I have a requirement to document their definitions. So how would I know if it is a standard Azure RBAC role or built in SQL or built in Cosmos and so on. So that I would use the proper command? – Jimmy Commented Mar 16 at 14:50
  • There is no direct command to identify if a GUID belongs to Azure RBAC, Cosmos DB, or SQL. You can create a script to first check Azure RBAC using az role definition list, then Cosmos DB roles with az cosmosdb sql role definition show. – Sridevi Commented Mar 17 at 3:03
Add a comment  | 

1 Answer 1

Reset to default 1

Note that 00000000-0000-0000-0000-000000000001 is role ID for Cosmos DB Built-in Data Reader Role. It is not a standard Azure RBAC role, so it cannot be retrieved using the az role definition list command.

Initially, I too got blank results when I run below Azure CLI command:

az role definition list --name "00000000-0000-0000-0000-000000000001"

Response:

To retrieve the role definition for a Cosmos DB SQL role, use this Azure CLI command:

az cosmosdb sql role definition show --account-name cosmosdbname --resource-group rgname --id "00000000-0000-0000-0000-000000000001"

Response:

Reference:

Use data plane role-based access control - Azure Cosmos DB for NoSQL | Microsoft

发布评论

评论列表(0)

  1. 暂无评论