Describe the bug
The GrantPermissions.ps1 script is failing if the Microsoft Graph PowerShell service principal doesn't have the Application.Read.All permission.
Module Name
The latest permission script.
To Reproduce
Steps to reproduce the behavior:
Make sure the Microsoft Graph PowerShell doesn't exist in the tenant, or that it doesn't have the scope permissions Application.Read.All.
Run the script with the recommended roles.
Here is the error message in the script's output:
Get-MgServicePrincipal : Insufficient privileges to complete the operation.
At line:81 char:5
+ Get-MgServicePrincipal -Filter "displayName eq '$AppName'"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({ ConsistencyLe...ndProperty = }:<>f__AnonymousType27`9) [Get-MgServicePrincipal_List1], RestExcepti
on`1
+ FullyQualifiedErrorId : Authorization_RequestDenied,Microsoft.Graph.PowerShell.Cmdlets.GetMgServicePrincipal_List1
❌ Principal not found.
Additional context
Kudos to @Andrew-Bennett #356 see PR for fix.
Describe the bug The GrantPermissions.ps1 script is failing if the Microsoft Graph PowerShell service principal doesn't have the
Application.Read.All
permission.Module Name The latest permission script.
To Reproduce Steps to reproduce the behavior:
Application.Read.All
.Additional context Kudos to @Andrew-Bennett #356 see PR for fix.