May 24 2022 03:32 AM
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:
Group.Read.All
Group.ReadWrite.All
Tasks.Read
Tasks.ReadWrite
User.Read
User.Read.All
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
May 24 2022 09:21 AM
May 26 2022 09:25 AM
May 26 2022 11:22 PM