Azure AD Graph与MS Graph Application.ReadWrite.All

问题描述

我已经为DevOps管道设置了服务主体,用于创建服务主体/应用以供通过Azure CLI部署的服务使用,如下所示:

az ad sp create-for-rbac --name TestAccount1 --skip-assignment

如果我将以下权限分配给我的DevOps服务主体,则它可以正常工作:

enter image description here

但是,这显然会触发弃用警报,但是如果我将权限更改为:

enter image description here

我得到以下信息:

Directory permission is needed for the current user to register the application. For how to configure,please refer 'https://docs.microsoft.com/azure/azure-resource-manager/resource-group-create-service-principal-portal'. Original error: Insufficient privileges to complete the operation.

在谈到Azure AD Graph与Microsoft Graph时,我是否错过了一个微妙之处,难道它们只是将旧API和新API集成到同一Azure AD租户中吗?

解决方法

很明显,此cmd az ad sp create-for-rbac在后​​台调用Azure AD Graph API。

AAD Graph和Microsoft Graph的端点不同。

AAD图端点:https://graph.windows.net/

Microsoft Graph端点:https://graph.microsoft.com/

然后,当您在Azure门户上分配Application.ReadWrite.All权限时,您会发现此权限实际上在其相应的终结点下。

enter image description here

enter image description here

因此,如果您在Microsoft Graph下添加Application.ReadWrite.All权限,将不允许您调用Azure AD Graph。