Azure Active Directory appRoleAssignments "Permission being assigned was not found on application"

标签 azure azure-active-directory microsoft-graph-api

我正在尝试通过图形 API 将用户分配给 azure Active Directory 应用程序。 根据documentation我已将权限分配给我的应用程序并授予管理员同意。 向应用程序授予以下权限。

enter image description here 我的图形 API 请求详细信息如下

https://graph.microsoft.com/v1.0/users/user-id/appRoleAssignments

请求正文

{
    "appRoleId": "00000000-0000-0000-0000-000000000000",
    "principalId": "user-id",
    "principalType": "User",
    "resourceId": "objectId-of-service-principal"
}

AD API 的响应仍然提到在应用程序上找不到分配的权限 我还需要向应用程序授予哪些其他权限才能使请求正常工作?

最佳答案

我可以在我这边重现您的问题,这是由于您提供的 appRoleId 错误引起的,appRoleId 应该是 id分配给用户的appRole(在资源服务主体上定义),如果您没有定义,请按照此doc来定义它。

enter image description here

要查找 appRoleId,请导航到门户中的 Azure Active Directory -> 应用注册 -> 找到您定义了 appRole 的 AD 应用 -> Manifest -> appRoles -> 获取如下 id,它是 appRoleId.

enter image description here

然后再次用它测试API,它工作正常。

enter image description here

关于Azure Active Directory appRoleAssignments "Permission being assigned was not found on application",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66545151/

相关文章:

microsoft-graph-api - Microsoft Graph API - 发送电子邮件始终返回响应代码 403,错误文本为 "Access is denied. Check credentials and try again."

azure - 如何排除 Azure DevOps 构建管道中的一个分支

azure - 无法在 Azure Analysis Services 中添加/连接 CosmosDB

azure - 使用托管服务身份支持代表流程

c# - 如何使用 Microsoft Graph API 获取用户所属的组名?

azure-active-directory - Microsoft Graph API 用于读取分配给 Teams 用户的电话号码

xml - Azure B2C 自定义策略注册 UI - 删除显示名称

c# - 如何在使用依赖注入(inject)的 ASP.NET Core 2 中使用 OIDC 登录到 Azure AD 后添加自己的声明?

azure - 无法将显示名称中包含 ':' 的 Azure AD 组添加到 Azure SQL,我是否遗漏了什么?

azure-active-directory - Azure AD B2C 登录自定义策略记住用户