-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New-AzRoleAssignment returned an invalid status code 'BadRequest' #19374
Copy link
Copy link
Closed
Labels
Resource AuthorizationAzRole* in Az.ResourcesAzRole* in Az.Resourcescustomer-reportedneeds-author-feedbackMore information is needed from author to address the issue.More information is needed from author to address the issue.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Description
Description
On different GitHub runners, my action workflow runs the command:
WARNING: We have migrated the API calls for this cmdlet from Azure Active Directory Graph to Microsoft Graph.
Visit https://go.microsoft.com/fwlink/?linkid=2181475 for any permission issues.
New-AzRoleAssignment: D:\a_temp\b31e73ff-178e-4971-83ff-3c0113c92680.ps1:27
New-AzRoleAssignment -ObjectId $objectID -RoleDefinitionName "Storage …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Operation returned an invalid status code 'BadRequest'
Code that runs is as follows:
$objectID = (Get-AzVM -ResourceGroupName "${{env.RG}}" -Name "${{env.VMNAME}}").identity.principalid
Write-Output "Principal ID: $objectID"
New-AzRoleAssignment -ObjectId $objectID -RoleDefinitionName "Storage Blob Data Contributor" -ResourceGroupName "${{env.RG}}"
On some runners my script works and then there are some runners that show the above error. Can anyone explain why?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Resource AuthorizationAzRole* in Az.ResourcesAzRole* in Az.Resourcescustomer-reportedneeds-author-feedbackMore information is needed from author to address the issue.More information is needed from author to address the issue.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that