Microsoft.Graph New-MgBetaPlannerRoster is not working getting error Bad request

METOEVI, Isabelle (MTL) 25 Reputation points
2024-04-11T15:09:48.28+00:00

$tenantID ="id of the tenant"

$ClientID = "id of the client"

$CertThumbprint = "thumbprint of the certificate"

Connect-MgGraph -ClientID $clientID -TenantID $tenantID -CertificateThumbprint $CertThumbprint

$body = @'

{

    "title": "title"

}

'@

Invoke-MgGraphRequest -Method Post -Uri https://graph.microsoft.com/beta/planner/rosters -Body $body

I also used the following command:

$params= @{

 "data.type" = "#microsoft.graph.plannerRoster"

}

New-MgBetaPlannerRoster -BodyParameter $params

 and i still get the same error Bad request. It's shows no error message and unknownError

{"error":{"code":"UnknownError","message":"","innerError":{"date"......

I used the version 2.16.0 for graph but  got the same error with the 2.10.0

The registered apllication in Entra has the permissions 

Tasks.ReadWrite.All

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,246 questions
{count} vote

Accepted answer
  1. Luca Heiss 75 Reputation points
    2024-05-14T10:25:26.4733333+00:00

    So I finally managed to get this to work since I was struggling for weeks. The solution is to include the member parameter in the body parameter since every Roster container needs at least one member. When using an admin user the admin is automatically assigned. This does not work with Azure Application. The body needs to look like this:

    $params = @{

    "@odata.type" = "#microsoft.graph.plannerRoster"
    
    members = @(
    
    	@{
    
    		userId = "member@mail.com"
    
    	}
    
    )    
    

    }

    This resolved the Status 400 Bad Request for me.


0 additional answers

Sort by: Most helpful