Unable to get planner details associated with a group

Copper Contributor

Hi All,


I am trying to get Planner details for a group/team, below is my script. I have registered the app and it has all permissions:





yet it keeps giving me error "You do not have the required permissions to access this item"


$clientId = "[clientId]"  
$clientSecret = "[clientSecret]"  
$tenantName = "testtenant.onmicrosoft.com"  
$resource = https://graph.microsoft.com/  
$groupId ="5a987e93-d3db-4fde-96d0-f1a60ac2bd58"

$tokenBody = @{  
    Grant_Type    = "client_credentials"  
    Scope         = https://graph.microsoft.com/.default  
    Client_Id     = $clientId  
    Client_Secret = $clientSecret  
$tokenResponse = Invoke-RestMethod -Uri https://login.microsoftonline.com/$TenantName/oauth2/v2.0/token -Method POST -Body $tokenBody  

Connect-MgGraph -AccessToken $tokenResponse.access_token
Get-MgGroupPlannerPlan -GroupId $groupId


I cannot define scope in the script using Connect-MgGraph -Scopes 


Can please anyone let me know if I am missing anything ?


Thanks In Advance

3 Replies
Planner only supports delegate permissions, you cannot use the client credentials flow.
Thanks for your reply, the azure app already has delegate permissions, if you are referring to something else, please can you give a reference link.
The code sample you pasted above uses the client credentials flow, this results in getting a token in the application permissions model, not delegate one. Use the auth code/on behalf of flow instead.