【Azure 环境】使用 az ad group create 时候遇见 Insufficient privileges to complete the operation

简介: 【Azure 环境】使用 az ad group create 时候遇见 Insufficient privileges to complete the operation

问题描述

使用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 参数,用于输出完整的日志信息:

$ az ad group create --debug --display-name GroupTestAdministrator --mail-nickname azuretest 
cli.knack.cli: Command arguments: ['ad', 'group', 'create', '--debug', '--display-name', 'GroupTestAdministrator', '--mail-nickname', 'azuretest']
cli.knack.cli: __init__ debug log:
... ...
urllib3.connectionpool: Starting new HTTPS connection (1): graph.chinacloudapi.cn:443
urllib3.connectionpool: https://graph.chinacloudapi.cn:443 "POST /xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/groups?api-version=1.6 HTTP/1.1" 403 219
msrest.http_logger: Response status: 403
msrest.http_logger: Response headers:
... ... 
msrest.exceptions: Insufficient privileges to complete the operation.

查看以上错误日志,最主要的信息是在请求接口 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

第一步:获取到AAD应用 Windows Azure Active Directory00000002-0000-0000-c000-000000000000 下的所有Role ID。

通过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

相关文章
|
3月前
|
API Python
【Azure 环境】AAD 注册应用获取AAD Group权限接口遇 403 : Attempted to perform an unauthorized operation 错误
【Azure 环境】AAD 注册应用获取AAD Group权限接口遇 403 : Attempted to perform an unauthorized operation 错误
|
3月前
|
API
【Azure API 管理】解决API Management添加AAD Group时遇见的 Failed to query Azure Active Directory graph due to error 错误
【Azure API 管理】解决API Management添加AAD Group时遇见的 Failed to query Azure Active Directory graph due to error 错误
|
缓存 开发工具 iOS开发
Xcode The operation couldn’t be completed. (LaunchServicesError error 0.)问题的解决
Xcode The operation couldn’t be completed. (LaunchServicesError error 0.)问题的解决
Xcode The operation couldn’t be completed. (LaunchServicesError error 0.)问题的解决
SAP QM QS41 试图维护Catalog为3的Code Group, 报错-You need to maintain catalog 3 (Usage Decisions) in Customi
SAP QM QS41 试图维护Catalog为3的Code Group, 报错-You need to maintain catalog 3 (Usage Decisions) in Customi
SAP QM QS41 试图维护Catalog为3的Code Group, 报错-You need to maintain catalog 3 (Usage Decisions) in Customi
SAP QM 执行事务代码QA11 报错- Selected set code does not exist, or data entered is incomplete-
SAP QM 执行事务代码QA11 报错- Selected set code does not exist, or data entered is incomplete-
SAP QM 执行事务代码QA11 报错- Selected set code does not exist, or data entered is incomplete-
|
SQL 数据库 Windows
SQL Server 2005 sp_send_dbmail出现Internal error at FormatRowset (Reason: Not enough storage is available to complete this operation)
案例环境:   操作系统: Windows 2003 SE 32bit(SP2) 数据库版本:Microsoft SQL Server 2005 - 9.00.5069.00 (Intel X86)             Aug 22 2012 16:01:52           ...
1422 0
|
SQL 关系型数据库 MySQL
组复制官方翻译九、Group Replication Technical Details
https://dev.mysql.com/doc/refman/8.0/en/group-replication-technical-details.html 这一章主要描述MGR的更多细节 18.
1764 0