I’m trying to do some cleanup (to solve other issues) within a yaml, and I’ve come up with this:
- task: AzureCLI@2
inputs:
azureSubscription: 'MYSUBSCRIPTION'
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
az role assignment delete --ids "GUID1 GUID2 GUIDn"
name: CleanupRoleAssignments
And I’m getting this error:
ERROR: (MissingSubscription) The request did not have a subscription or a valid tenant level resource provider.
Code: MissingSubscription
Message: The request did not have a subscription or a valid tenant level resource provider.
I tried adding --scope
but that only got me an additional warning WARNING: option '--scope' will be ignored due to use of '--ids'
. The error persisted.
Any idea on what I’m doing wrong?
TIA
Jim
2
Answers
The –ids parameter expects resource IDs for the role assignments. This is what it should look like for a resource-specific assignment:
For assignments at subscription or resource group level, some of the parts of that ID would be left out.
The idea is that the ID identifies where the role assignment is as well as the assignment ID.
Try below in local pc: Replace with your own subscription and resource group
will return like
then delete the assignment using the id: