Forum Discussion

AGanesan2140's avatar
AGanesan2140
Copper Contributor
Sep 02, 2024

Issue in connecting Azure Ad user api command from PNP online PS script

I have created a Powershell script in Azure function app. Have connected pnponline using Client id and thumbprint by creating an App registration with Graph API. The code is as below.

 

Connect-PnPOnline -Url $adminSiteUrl -ClientId $clientId -Thumbprint $Thumbprint -Tenant "$($tenantName).onmicrosoft.com"
Write-Information "Connected Pnp online Successful"
$AzureAd = Get-PnPAzureADUser | Select-object Mail,DisplayName,UserPrincipalName

 

Pnp online script has connected successfully but on executing the last line Get-PnpAzureADUser, i am getting the error as below.

 

Error:

The provided value for scope User.Read.All is not valid. Client credential flows must have a scope value with /.default suffixed to the resource identifier (application ID URI).

 

Please help me on this issue.

 

 

 

  • __Nicole__'s avatar
    __Nicole__
    Copper Contributor
    I have the same Issue and I am using the Newest Version pnp 2.12.0

Resources