Created
May 14, 2025 06:16
-
-
Save nathanmcnulty/3c6d12d253a99aebe22b355ddd7341d0 to your computer and use it in GitHub Desktop.
Add permissions to Managed Identity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$SP_ID = '3b3c5db1-c095-41c7-af10-2a958ccaf91a' | |
Connect-MgGraph -Scopes appRoleAssignment.ReadWrite.All,Application.Read.All,Group.ReadWrite.All | |
$GraphSP = Get-MgServicePrincipal -Filter "appId eq '00000003-0000-0000-c000-000000000000'" | |
$AppRole = $GraphSP.AppRoles | Where-Object {$_.Value -eq "SecurityEvents.Read.All" -and $_.AllowedMemberTypes -contains "Application"} | |
New-MgServicePrincipalAppRoleAssignment -AppRoleId $AppRole.Id -ServicePrincipalId $SP_ID -ResourceId $GraphSP.Id -PrincipalId $SP_ID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment