powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[BUG] Add-PnPMicrosoft365GroupMember throws "The input does not contain any JSON Tokens" while using the managed identity

Open msekkappan opened this issue 1 year ago • 1 comments

Notice

Many bugs reported are actually related to the PnP Framework which is used behind the scenes. Consider carefully where to report an issue:

  1. Are you using Invoke-PnPSiteTemplate or Get-PnPSiteTemplate? The issue is most likely related to the Provisioning Engine. The Provisioning engine is not located in the PowerShell repo. Please report the issue here: https://github.com/pnp/pnpframework/issues. No

  2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue? Then please continue reporting the issue in this repo. No

  3. If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/pnp/powershell/tree/master/src/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/pnp/pnpframework/issues

Reporting an Issue or Missing Feature

No

Expected behavior

Please describe what output you expect to see from the PnP PowerShell Cmdlets Add-PnPMicrosoft365GroupMember is supposed to add members to the group, instead throws JSON token error in automation runbook

Actual behavior

Please describe what you see instead. Please provide samples of output or screenshots. image

Steps to reproduce behavior

Please include complete script or code samples in-line or linked from gists

Works
     Connect-PnPOnline -ClientId $AppID -Url $site -Tenant $tenant -AzureEnvironment $env -Thumbprint $thumbprint

Throws the JSON token error
    Connect-PnPOnline -Url $site -ManagedIdentity

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name "PnP.PowerShell" -ListAvailable) 2.12.0

Which operating system/environment are you running PnP PowerShell on?

 Azure Automation in GCC 

msekkappan avatar Dec 03 '24 18:12 msekkappan

Hey, you should also pass Connect-PnPOnline -Url $site -ManagedIdentity -AzureEnvironment $env. Please do let us know if it works after this change.

gautamdsheth avatar Dec 15 '24 15:12 gautamdsheth