-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
az role assignment delete
command is an insane footgun
#13577
Comments
@dharmab Thanks for the feedbacks! Actually, this is a behavior as expected, which provides users a way to delete all the role assignments in a subscription. @yungezz I personally recommend we add an example in the doc to describe the usage rather than change the command itself which may block the users that are already using this way to delete all their role assignments. |
Why is this something a user would ever want to do? And why is it the default if no arguments are passed? That's like if you typed |
Whether or not someone would want to delete all of their role assignments in a subscription is not necessarily at issue. The problem is that this is absolutely the wrong way to offer that feature. Something so destructive should require additional arguments! Prompting the user for confirmation when they enter |
hi @dharmab thanks for raise the issue. I see the concern. Actually that's the reason cli prompt for a confirmation for delete all. We'll look at customer scenario again to validate this. |
I accidentally did this: az role assignment create --assignee "$SOME_VAR" --role "Owner" SOME_VAR was accidentally set to empty string. I did not get any prompt and EVERY OWNER WAS DELETED.I lost access to my subscription. Cannot even file a support ticket cause I lost permissions. |
Forget to mention: core 2.7.0 * |
@Catramen I'm so sorry. I'm not a MSFT employee but I'll forward your comment to my TAM and hopefully they can help route it. |
This issue was previously reported in #2933 and the prompt for "delete all" was added in #8862. The logic is to search for all assignments and delete them all: assignments = _search_role_assignments(cmd.cli_ctx, assignments_client, definitions_client,
scope, assignee, role, include_inherited,
include_groups=False)
if assignments:
for a in assignments:
assignments_client.delete_by_id(a.id) I agree this behavior is insane and should be changed even though it is a breaking change. If you have already deleted all role assignments, and luckily you are a Global Administrator in AAD tenant, there is a chance to recover it: https://docs.microsoft.com/en-us/azure/role-based-access-control/elevate-access-global-admin |
This specific issue is tracked in #15278. We'll fix it to throw error when --assignee is empty string in Today |
Was this ever fixed? EDIT: Ah, it was (at least partially) fixed in PR #15282. EDIT: This is still a hideously dangerous footgun. |
I have created PR #30470 to remove the "delete all role assignments under the subscription by default" behavior. At least one of I also proposed a more aggressive solution: make @dharmab, @Starblade42, @Catramen, @evanfoster, please kindly share your thoughts or suggestions. |
Describe the bug
If you type
az role assignment delete
with no arguments, the Azure CLI offers to delete every role assignment in your subscription. This is insane.To Reproduce
az role assignment delete
with no argumentsExpected behavior
Literally anything else
Environment summary
Homebrew
Additional context
This reminds me of how
az vmss delete-instances
used to offer to delete every single one of your VMs if you didn't pass in--instance-ids
. Now it just raises an error, which is sane behavior.The text was updated successfully, but these errors were encountered: