Skip to content
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 snapshot create does not create a snapshot if the --name already exists and does not report any error #28879

Open
jeffquaintance opened this issue May 2, 2024 · 1 comment
Assignees
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team Compute az vm/vmss/image/disk/snapshot customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone

Comments

@jeffquaintance
Copy link

Related command

az snapshot create -g MyResourceGroup -n MySnapshot2 --source "/subscriptions/00000/resource
Groups/AnotherResourceGroup/providers/Microsoft.Compute/disks/MyDisk"

Is your feature request related to a problem? Please describe.

When creating a new snapshot, if one of the same name (e.g. MySnapshot2) already exists in MyResourceGroup, the snapshot create command will not overwrite it or report any failure, the exit code is 0. The only clear way to identify this is to compare the timeCreated snapshot value with current time.

Describe the solution you'd like

Ideally, snapshot create would report an error or return a non-zero exit status, alternatively it would be nice to pass a flag to overwrite existing snapshots:
az snapshot create -g MyResourceGroup -n MySnapshot2 --overwrite --source "/subscriptions/00000/resource
Groups/AnotherResourceGroup/providers/Microsoft.Compute/disks/MyDisk"

doing both would be best.

Describe alternatives you've considered

I don't have any alternative, I understand why az snapshot create would not assume it safe to overwrite an existing snapshot, but the command should be more verbose about what action it is or is not taking

Additional context

I was unsure if this is a feature request or a bug, current azure-cli version information:
azure-cli 2.60.0

core 2.60.0
telemetry 1.1.0

Extensions:
fzf 1.0.2
resource-graph 2.1.0

Dependencies:
msal 1.28.0
azure-mgmt-resource 23.1.0b2

Python (Darwin) 3.11.9 (main, Apr 2 2024, 08:25:04) [Clang 15.0.0 (clang-1500.3.9.4)]

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Compute az vm/vmss/image/disk/snapshot labels May 2, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented May 2, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels May 2, 2024
@yonzhan yonzhan added this to the Backlog milestone May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team Compute az vm/vmss/image/disk/snapshot customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

4 participants