【Azure 环境】使用 az ad group create 时候遇见 Insufficient privileges to complete the operation - LuBu0505/My-Code GitHub Wiki
问题描述
使用China Azure,通过Azure CLI 创建AAD组报错,提示权限不足 Insufficient privileges to complete the operation
# 使用这个登录:
az login --service-principal --username xxx--password xxx--tenant xxx
#执行 az ad group create
az ad group create --display-name GroupTestAdministrator --mail-nickname azuretest
问题解决
为了查看更完整的错误信息,在 az ad group create 命令中添加 --debug 参数,用于输出完整的日志信息:
查看以上错误日志,最主要的信息是在请求接口 **https://graph.chinacloudapi.cn** 时,报错403。而 graph.chinacloudapi.cn 是使用的旧的Azure AD Graph终结点。现在新的为 Microsoft Graph(**https://microsoftgraph.chinacloudapi.cn/**)。
Azure Active Directory (Azure AD) Graph 已弃用,将于近期停用。 作为此弃用路径的一部分,现在已禁用通过Azure 门户向应用注册添加 Azure AD Graph 权限。
为应用注册配置所需的 Azure AD Graph 权限:https://learn.microsoft.com/zh-cn/graph/migrate-azure-ad-graph-configure-permissions
所以,根据此文的介绍,如要继续使用 az ad group create 创建AD Group,可以修改注册应用的清单权限,来实现赋权。详细步骤见:https://learn.microsoft.com/zh-cn/graph/migrate-azure-ad-graph-configure-permissions#option-2-update-the-application-manifest-on-the-azure-portal
Windows Azure Active Directory
或 00000002-0000-0000-c000-000000000000 下的所有Role ID。
第一步:获取到AAD应用 通过Azure CLI指令: az ad sp show --id 00000002-0000-0000-c000-000000000000 , 过滤出结果zhozho能够的 Role ID。
第二步: 在AAD的注册应用中,通过清单,找到requiredResourceAccess,将 00000002-0000-0000-c000-000000000000 中获取的所有权限,以下表的方式 添加到当前 注册应用的清单中。
"requiredResourceAccess": [
{
"resourceAppId": "00000002-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "a42657d6-7f20-40e3-b6f0-cee03008a62a",
"type": "Scope"
},
{
"id": "5778995a-e1bf-45b8-affa-663a9f3f4d04",
"type": "Scope"
},
{
"id": "78c8a3c8-a07e-4b9e-af1b-b5ccab50a175",
"type": "Scope"
},
{
"id": "6234d376-f627-4f0f-90e0-dff25c5211a3",
"type": "Scope"
},
{
"id": "970d6fa6-214a-4a9b-8513-08fad511e2fd",
"type": "Scope"
},
{
"id": "311a71cc-e848-46a1-bdf8-97ff7156d8e6",
"type": "Scope"
},
{
"id": "c582532d-9d9e-43bd-a97c-2667a28ce295",
"type": "Scope"
},
{
"id": "cba73afc-7f69-4d86-8450-4978e04ecd1a",
"type": "Scope"
},
{
"id": "5778995a-e1bf-45b8-affa-663a9f3f4d04",
"type": "Role"
},
{
"id": "78c8a3c8-a07e-4b9e-af1b-b5ccab50a175",
"type": "Role"
}
]
},
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "8b010b06-ce5b-41ce-bc8b-fa9acdb14371",
"type": "Scope"
}
]
}
],
参考资料
更新Azure 门户上的应用程序清单 : https://learn.microsoft.com/zh-cn/graph/migrate-azure-ad-graph-configure-permissions#option-2-update-the-application-manifest-on-the-azure-portal
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
分类: 【Azure 环境】, 【Azure Developer】
标签: Timer Trigger不能多实例运行, az ad group create, Azure AD Graph终结点, (https://microsoftgraph.chinacloudapi.cn/), https://graph.chinacloudapi.cn