-
|
I am trying to assign Graph roles to a managed identity using the bicep extension, but I can't get it to work. Unfortunately, the error returned while running the deployment is not useful at all to find the issue. I am certain it has something to do with the rights of the deployer, but I can't figure out what to assign to it and how. The deployment is done using CD (Azure DevOps) with a managed identity. The script that fails looks like this And the error I get is this Does someone knows what permissions I am missing here to be able to deploy this? (As a note, I have removed everything except the service principal retrieval, but it still fails.) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
The missing permissions are on the identity that runs the deployment, not on the managed identity you are creating. Your error target is resource graphServicePrincipal 'Microsoft.Graph/servicePrincipals@v1.0' existing = {
appId: '00000003-0000-0000-c000-000000000000'
}For Then, for creating So for an Azure DevOps CD deployment that runs as a managed identity, grant Microsoft Graph application permissions to the service principal of that deployment identity: and grant admin consent for them. Azure RBAC roles like Owner/Contributor on the subscription do not cover these Microsoft Graph calls. If you test interactively instead of app-only, the signed-in user also needs a supported Entra role. The Graph API docs list After the permissions are fixed, your Bicep shape looks basically right: Docs:
|
Beta Was this translation helpful? Give feedback.
-
|
Ok, So after investigating today, it's clear that the issue is deployment stack. This module does not work with deployment stacks (which we are using) and that caused this. I tried to deploy using a ordinary deployment and it worked. |
Beta Was this translation helpful? Give feedback.
Ok, So after investigating today, it's clear that the issue is deployment stack. This module does not work with deployment stacks (which we are using) and that caused this. I tried to deploy using a ordinary deployment and it worked.