rubrikinc / polaris-o365-powershell

PowerShell commands for managing Polaris M365 protection
MIT License
7 stars 14 forks source link

Added User.Read into scopes for Connect-Graph #30

Closed scottwtang closed 2 years ago

scottwtang commented 2 years ago

Description

Related Issue

https://github.com/rubrikinc/polaris-o365-powershell/issues/29

Motivation and Context

The cmdlet Get-MgOrganization cannot be called without the proper permissions. User.Read is the lowest level permission to run the cmdlet. It's not required to specify User.Read when connecting to MS Graph, but the permission needs to be consented to. By directly specifying this permission in the scopes when connecting, the user will be prompted to grant consent for the permission.

How Has This Been Tested?

Tested by running Connect-MgGraph -Scopes "Application.ReadWrite.All", with no permissions already consented to. Running Get-MgOrganization fails due to insufficient privileges.

Reconnecting with Connect-MgGraph -Scopes "Application.ReadWrite.All", "User.Read" allows the cmdlet Get-MgOrganization to be run succesfully

Reconnecting with Connect-MgGraph with no scopes, the cmdlet Get-MgOrganization still runs as User.Read permission has already been consented to

Screenshots (if appropriate):

image

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

Checklist:

Go over all the following points, and put an x in all the boxes that apply. If you're unsure about any of these, don't hesitate to ask. We're here to help!

drew-russell commented 2 years ago

Thanks @scottwtang ! Looks great.