az snapshot create does not create a snapshot if the --name already exists and does not report any error #28879
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
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)]
The text was updated successfully, but these errors were encountered: