Last active
June 29, 2021 07:50
-
-
Save LauraKokkarinen/f028af49e88e015a8315e0b49202d6e8 to your computer and use it in GitHub Desktop.
This file contains 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
# Replace with your managed identity object ID | |
$miObjectID = "17707c90-dab4-483d-a57f-65e91ac3d94f" | |
# The app ID of the API where you want to assign the permissions | |
$appId = "00000003-0000-0000-c000-000000000000" | |
# The app IDs of the Microsoft APIs are the same in all tenants: | |
# Microsoft Graph: 00000003-0000-0000-c000-000000000000 | |
# SharePoint Online: 00000003-0000-0ff1-ce00-000000000000 | |
Connect-AzureAD | |
$app = Get-AzureADServicePrincipal -Filter "AppId eq '$appId'" | |
$appRoles = Get-AzureADServiceAppRoleAssignment -ObjectId $app.ObjectId | where PrincipalId -eq $miObjectID | |
foreach ($appRole in $appRoles) { | |
$role = $app.AppRoles | where Id -eq $appRole.Id | Select-Object -First 1 | |
write-host $role.Value | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment