【发布时间】:2018-09-19 15:56:47
【问题描述】:
我们在同一个目录中有两个 azure 资源。 Azure API 管理和 Azure 函数背后的一组 webAPI API。我们希望 azure 函数能够调用 API。如How to use managed identities for App Service and Azure Functions 中所述,我们已在 azure 功能上启用 MSI。我们在 AAD 中为 API 创建了应用注册,创建了要访问的角色权限。在Calling your APIs with Azure AD Managed Service Identity using application permissions 之后,我们在尝试将权限/角色分配给 azure 函数时遇到错误: 在PowerShell中:
New-AzureADServiceAppRoleAssignment -ObjectId 8XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -Id 3XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -PrincipalId 8XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -ResourceId 9XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
New-AzureADServiceAppRoleAssignment : Error occurred while executing NewServicePrincipalAppRoleAssignment
Code: Authorization_RequestDenied
Message: Insufficient privileges to complete the operation.
HttpStatusCode: Forbidden
HttpStatusDescription: Forbidden
HttpResponseStatus: Completed
At line:1 char:1
+ New-AzureADServiceAppRoleAssignment -ObjectId 8XXXXXX-XXXX-XXXX-XXXX ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureADServiceAppRoleAssignment], ApiException
+ FullyQualifiedErrorId : Microsoft.Open.AzureAD16.Client.ApiException,Microsoft.Open.AzureAD16.PowerShell.NewServ
icePrincipalAppRoleAssignment
给我们一个权限错误,即使 AAD 管理员(我认为是 AAD DC 管理员的成员)运行它也是如此。有没有人遇到过这个?为什么这会引发权限错误?我们已经验证了 3 个不同的人的 id 是正确的。
【问题讨论】:
标签: azure azure-active-directory azure-functions azure-api-management azure-managed-identity