Skip to content

Instantly share code, notes, and snippets.

@AlexanderHolmeset
Last active August 27, 2023 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexanderHolmeset/2e837dc9c46c76eff2da1f36832a6815 to your computer and use it in GitHub Desktop.
Save AlexanderHolmeset/2e837dc9c46c76eff2da1f36832a6815 to your computer and use it in GitHub Desktop.
$TenantID = "xxxxxx"
$LogicAppSeObjectID = "xxxxxxx"
$ServicePrincipalId = $LogicAppSeObjectID
$GraphResource = Get-MgServicePrincipal -Filter "AppId eq '00000003-0000-0000-c000-000000000000'"
$application_role_to_assign_name = "Chat.Read.All"
$Permission = $GraphResource.AppRoles | Where-Object {$_.value -in $application_role_to_assign_name}
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $ServicePrincipalId -PrincipalId $ServicePrincipalId -AppRoleId $Permission.Id -ResourceId $GraphResource.Id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment