microsoftgraph / microsoftgraph/msgraph-bicep-types

Bug with the error generated from accidentally using the a managed Identity Client ID instead of the Principal ID

Open
#229 3 comments 0 reactions 1 assignee View on GitHub

@jason-dou is already working on this.

Since Mar 6, 2025.

bug graph-platform triaged
Dominant language
TypeScript
Stars
80
Forks
15
Avg merge
1h 21m
Merged PRs (30d)
3

Description

Bicep version
0.33.93

Resource and API version
Microsoft.Graph/groups - v1.0:0.1.9-preview

Auth flow
signed-in user

Deployment details
Creating a group with an assigned member

Describe the bug
I recently attempted a group deployment using the Client ID of a managed Identity as a member of the group and got the error: An unexpected 'EndOfInput' node was found when reading from the JSON reader. A 'StartObject' node was expected.

Finally, I figured out that this was not the actual error. Obviously, this error must be happening somewhere down the road, but the true error was that I was accidentally passing the Client ID into the members array instead of the Principal ID.

To Reproduce
Steps to reproduce the behavior:

resource updatedGroup 'Microsoft.Graph/groups@v1.0' = {
    uniqueName: <uniqueName>
    displayName: <displayName>
    mailEnabled: false
    mailNickname: <mailNickname>
    securityEnabled: true
    members: [
      <Put a Client ID here>
    ]
  }

Additional context
bicepconfig.json extensions node

"extensions": {
    "microsoftGraphV1": "br:mcr.microsoft.com/bicep/extensions/microsoftgraph/v1.0:0.1.9-preview"
}

Here is my full template

@secure()
param managedIdentityId string

var groupArray = loadJsonContent('../azure.json', 'databases')

extension microsoftGraphV1

// Reference existing group and its current members
resource existingGroup 'Microsoft.Graph/groups@v1.0' existing = [ 
  for (group, i) in groupArray: {
    uniqueName: group.permissionsGroup
  }
]

// Merge existing members with new members (avoids duplicates)
resource updatedGroup 'Microsoft.Graph/groups@v1.0' = [
  for (group, i) in groupArray: {
    uniqueName: group.permissionsGroup
    displayName: group.permissionsGroup
    mailEnabled: false
    mailNickname: group.permissionsGroup
    securityEnabled: true
    members: [
      managedIdentityId
    ]
    dependsOn: [
      existingGroup[i]
    ]
  }
]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.