Azure Quick PowerShell: Remove User RBAC Assignments

How to remove a user’s explicit Role Assignments from everywhere in a subscription.

1Get-AzRoleAssignment -SignInName username@example.com | Remove-AzRoleAssignment

Notes

  • Assumes Connect-AzAccount and Set-AzContext have been used to connect and switch to the correct subscription.
  • Assignments through group membership won’t be touched.
  • ReadOnly and DoNotDelete Resource Locks may prevent deletion of a specific assignment. In this case an error is returned.
1Remove-AzRoleAssignment: Operation returned an invalid status code 'Conflict'