Which permissions do I need to create a new Planner plan programmatically in PowerShell?

Khalid Hajjouji 50 Reputation points
2024-03-22T16:29:32.9766667+00:00

I would like to create a new Planner plan programmatically with PowerShell. Which permissions do I need? I am already a global admin. I received this error:

New-MgPlannerPlan_Create: C:\PS\Diversen\CreatePlannerPlan.ps1:13:5

Line |

13 | $plan = New-MgPlannerPlan -BodyParameter $params

| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

| You do not have the required permissions to access this item, or the item may not exist. Status: 403 (Forbidden)

Connect-MgGraph

$groupid = "someGUID"
$planName = "someName"

$params = @{
    container = @{
        url = "https://graph.microsoft.com/v1.0/groups/$groupid"
    }
    title     = $planName
}
try {
    $plan = New-MgPlannerPlan -BodyParameter $params
}
catch {
    write-error "Could not create the plan. Error:`n $_"
    exit
}
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-03-26T03:36:18.99+00:00

    Hi hajjk,

    Please make sure your account is a work or school account and a member of the group.

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.