microsoftgraph / microsoftgraph/msgraph-bicep-types
Insufficient privileges to complete the operation on getting Application/Service principal via existing syntax
@jason-dou is already working on this.
Since Sep 19, 2024.
- Dominant language
- TypeScript
- Stars
- 80
- Forks
- 15
- Avg merge
- 1h 21m
- Merged PRs (30d)
- 3
Description
Bicep version
Bicep CLI version 0.30.3 (2f0e78dcae)
Resource and API version
Microsoft.Graph/applications@v1.0, Microsoft.Graph/servicePrincipals@v1.0
Auth flow
automated, initially tested with Cloud Application Administrator role but after that I have added Global administrator. result is the same.
Deployment details
Insufficient privileges to complete the operation. Graph client request id: afff112b-8a8c-4f20-a1dd-9640b2a09d5e. Graph request timestamp: 2024-09-18T13:25:58Z. (Code: Forbidden)
Correlation ID: 7c517c2b-7f6a-4083-b50a-84365d8a1ebe
Describe the bug
To have successful deployment and service principal to be added as member to group.
To Reproduce
This should be minimum reproducible template. You need to enter information for your own environment,
extension microsoftGraph
param entraGroup object = {
name: 'ExampleGroup2'
type: 'Security'
displayName: 'Example Group 2'
mailNickname: 'exampleGroup2'
members: [
{
name: 'SomeName'
type: 'Application'
}
]
owners: []
}
var defaultMember = {
subscriptionId: subscription().subscriptionId
resourceGroup: ''
name: ''
appId: ''
}
resource memberManagedIdentities 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-07-31-preview' existing = [
for (member, i) in entraGroup.members: if (member.type =~ 'UserAssignedManagedIdentity') {
//https://github.com/Azure/bicep/issues/13937
name: empty(union(defaultMember, member).name) ? 'dummy${i}' : member.name
scope: resourceGroup(union(defaultMember, member).subscriptionId, union(defaultMember, member).resourceGroup)
}
]
resource memberApplications 'Microsoft.Graph/applications@v1.0' existing = [
for (member, i) in entraGroup.members: if (member.type =~ 'Application') {
//https://github.com/Azure/bicep/issues/13937
uniqueName: empty(union(defaultMember, member).name) ? 'dummy${i}' : member.name
}
]
resource memberServicePrincipals 'Microsoft.Graph/servicePrincipals@v1.0' existing = [
for (member, i) in entraGroup.members: if (member.type =~ 'Application') {
appId: memberApplications[i].appId
}
]
resource memberServicePrincipalsStandalone 'Microsoft.Graph/servicePrincipals@v1.0' existing = [
for (member, i) in entraGroup.members: if (member.type =~ 'ServicePrincipal') {
//https://github.com/Azure/bicep/issues/13937
appId: empty(union(defaultMember, member).appId) ? 'dummy${i}' : member.appId
}
]
resource memberGroups 'Microsoft.Graph/groups@v1.0' existing = [
for (member, i) in entraGroup.members: if (member.type =~ 'Group') {
//https://github.com/Azure/bicep/issues/13937
uniqueName: empty(union(defaultMember, member).name) ? 'dummy${i}' : member.name
}
]
resource entraGroupRes 'Microsoft.Graph/groups@v1.0' = {
uniqueName: entraGroup.name
displayName: entraGroup.displayName
mailEnabled: false
mailNickname: entraGroup.mailNickname
securityEnabled: true
description: null
members: [
for (member, i) in entraGroup.members: member.type =~ 'UserAssignedManagedIdentity'
? memberManagedIdentities[i].properties.principalId
: member.type =~ 'Application'
? memberServicePrincipals[i].id
: member.type =~ 'ServicePrincipal'
? memberServicePrincipalsStandalone[i].id
: member.type =~ 'Group' ? memberGroups[i].id : member.type =~ 'PrincipalId' ? member.principalId : ''
]
}
Additional context
Add any other context about the problem here. For example, what permissions does the identity have if it's a permission issue?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.