An Azure service that provides fine-grained access management for Azure resources, enabling you to grant users only the rights they need to perform their jobs.
Hi,
Tested and code similar to below works fine:
$token = (Get-AzAccessToken).Token
$headers = @{
"Authorization" = "Bearer {0}" -f ($token)
}
$APIUri = "https://management.azure.com/subscriptions/71842a2a-a468-4be0-ae53-db3293f22007/resourceGroups/OK-RG-My-Development/providers/Microsoft.Authorization/roleAssignments/ca161a04-3519-42fa-b6b4-117a2157d98b?api-version=2022-04-01"
$parameters = @"
{
"properties": {
"roleDefinitionId": "/subscriptions/71842a2a-a468-4be0-ae53-db3293f22007/resourceGroups/OK-RG-My-Development/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7",
"principalId": "ae2620bc-453e-4e5b-b164-fd68ada93334"
}
}
"@
Invoke-RestMethod -Headers $headers -Uri $APIUri -Method PUT -Body $parameters -ContentType "application/json"
If the above was useful please click Accept Answer.
Thanks.
-TP