PowerShell MicrosoftTeams and Access Denied on policy package

jelloland 51 Reputation points
2023-07-03T17:13:48.05+00:00

I have a PowerShell script that uses the MicrosoftTeams module (5.1.0) in order to run Grant-CsUserPolicyPackage on certain new users based on criteria. This script authenticates with a certificate via an app registration.

When running that command, however, I just get Access Denied errors.

What permission do I need to run this command? I added Policy.ReadWrite.* to its API permissions and its service principal is a member of the Teams Administrators role, but I still can't get it it to go through without the access denied error.

Windows for business Windows Server User experience PowerShell
Microsoft Security Microsoft Graph
Microsoft Teams Microsoft Teams for business Other
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2023-07-04T05:16:48.61+00:00

    Hi @jelloland

    According to the documentation, when assigning API permissions to an application, for *-Cs cmdlets - the Microsoft Graph API permission needed is .Organization.Read.All

    **
    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.


    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

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.