Created
April 27, 2026 20:29
-
-
Save alfespa17/a2b49608a990399519bc0d77e439c231 to your computer and use it in GitHub Desktop.
Add app role to managed identity service principal
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
| $payload = @{ | |
| appRoleId = "6195ee1a-0073-41e1-85c5-5b2e046a174d" # App role id from app registration manifest | |
| principalId = "65ed2d02-c88f-423f-be4c-c6a5322171a5" # Object Id from managed identity enterprise application | |
| resourceId = "2472d3cf-3fbe-421d-892b-5f54910880aa" # Object Id from enterprise application in app registration where role is defined | |
| } | |
| $payload | ConvertTo-Json | Out-File "tmp_payload.json" -Encoding utf8 | |
| az rest --method post ` | |
| --uri "https://graph.microsoft.com/v1.0/servicePrincipals/65ed2d02-c88f-423f-be4c-c6a5322171a5/appRoleAssignments" ` | |
| --body "@tmp_payload.json" ` | |
| --headers "Content-Type=application/json" | |
| Remove-Item "tmp_payload.json" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment