Request: Option to delete OS VHD within VM delete operation
CLI Version: 0.9.19 OS Type: Mac OSX Installation via: mac installer
Mode: ARM
Description:
Feature request: add an option flag to enable us to delete the OS vhd within the same operation used to delete VM. E.g.
azure vm delete -d
where -d (or similar, seen -b in past) would instruct Azure to delete the os vhd following the VMs removal.
@huangpf @sauryadas - Please take a look at this feature request. +1 from my side for this. Makes customers life easy.
+1
Just wondering if this is getting addressed at all. It's marked as a P1, but going on nearly 6 months without being implemented...
We really would need such a feature in the current azure CLI - this blocks us to upgrade our CLI as it works in the MacOS azure cli version 0.10.9 (flag "-b") [see my comment in issue 657]
@joergrech
0.10.9 seems to be a recent version. I don't think we ever added new fields or deprecated this field.
May I know if you can share the logs with 0.10.9 with us, and may I know (if feasible) which version did you find this option not working anymore? Thanks.
I think what you refer to is a command in ASM mode, and now this option is not supported in the new ARM mode.
ASM azure vm delete:
help: Delete the VM
help:
help: Usage: vm delete [options] <name>
help:
help: Options:
help: -h, --help output usage information
help: -v, --verbose use verbose output
help: -vv more verbose with debug output
help: --json use json output
help: -d, --dns-name <name> only show VMs for this DNS name
help: -b, --blob-delete Remove image and disk blobs
help: -q, --quiet quiet mode, do not ask for delete confirmation
help: -s, --subscription <id> the subscription id
help:
help: Current Mode: asm (Azure Service Management)
ARM azure vm delete:
help: Delete a virtual machine in a resource group
help:
help: Usage: vm delete [options] <resource-group> <name>
help:
help: Options:
help: -h, --help output usage information
help: -v, --verbose use verbose output
help: -vv more verbose with debug output
help: --json use json output
help: -g, --resource-group <resource-group> the resource group name
help: -n, --name <name> the virtual machine name
help: -q, --quiet quiet mode, do not ask for delete confirmation
help: -s, --subscription <subscription> the subscription identifier
help:
help: Current Mode: arm (Azure Resource Management)
@joergrech
There is a new Compute resource managed-disk that could help you manage disks in a much easier way. Please refer to: azure managed-disk -h and https://azure.microsoft.com/en-us/services/managed-disks/.
With that said, I haven't confirmed with the team yet, but I doubt we would provide this option alongside with the new stack azure vm delete command. Even if we do, we are going to craft a new command to do it. The reason is mainly that these commands are built as low and raw level commands that 1-1 match with REST APIs, and we don't tend to do more wrapping on it. Especially now in the new stack storage and compute are separate and loosely coupled resource types in ARM.
The problem should be mitigated by using additional commands to handle the blob as well as other storage/disk artifacts. Thanks.
Here is my output from the "azure" CLI and the "az" CLI on MacOS Sierra 10.12.5 and Ubunut 14.04 - as you can see "azure vm delete" has an option to delete OS-Disks (blobs) with the VM while "az vm delete" does not. Similarily, azure 0.10.6 on Linux(Ubuntu) does not have the delete blob flag:
azure on MacOS Sierra 10.12.5
$ azure --version
0.10.9 (node: 6.2.2)
$ azure vm delete --help
help: Delete the VM
help:
help: Usage: vm delete [options] <name>
help:
help: Options:
help: -h, --help output usage information
help: -v, --verbose use verbose output
help: -vv more verbose with debug output
help: --json use json output
help: -d, --dns-name <name> only show VMs for this DNS name
help: -b, --blob-delete Remove image and disk blobs
help: -q, --quiet quiet mode, do not ask for delete confirmation
help: -s, --subscription <id> the subscription id
help:
help: Current Mode: asm (Azure Service Management)
az on MacOS Sierra 10.12.5
$ az --version
azure-cli (2.0.6)
acr (2.0.4)
acs (2.0.6)
appservice (0.1.6)
batch (2.0.4)
cdn (0.0.2)
cloud (2.0.2)
cognitiveservices (0.1.2)
command-modules-nspkg (2.0.0)
component (2.0.4)
configure (2.0.6)
core (2.0.6)
cosmosdb (0.1.6)
dla (0.0.6)
dls (0.0.6)
feedback (2.0.2)
find (0.2.2)
interactive (0.3.1)
iot (0.1.5)
keyvault (2.0.4)
lab (0.0.4)
monitor (0.0.4)
network (2.0.6)
nspkg (3.0.0)
profile (2.0.4)
rdbms (0.0.1)
redis (0.2.3)
resource (2.0.6)
role (2.0.4)
sf (1.0.1)
sql (2.0.3)
storage (2.0.6)
vm (2.0.6)
Python (Darwin) 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
Python location '/Users/jorgrech/lib/azure-cli/bin/python'
$ az vm delete --help
Command
az vm delete: The operation to delete a virtual machine.
Arguments
--no-wait : Do not wait for the long running operation to finish.
--yes -y : Do not prompt for confirmation.
Resource Id Arguments
--ids : One or more resource IDs (space delimited). If provided, no other 'Resource
Id' arguments should be specified.
--name -n : The name of the Virtual Machine. You can configure the default using `az
configure --defaults vm=<name>`.
--resource-group -g: Name of resource group. You can configure the default group using `az
configure --defaults group=<name>`.
Global Arguments
--debug : Increase logging verbosity to show all debug logs.
--help -h : Show this help message and exit.
--output -o : Output format. Allowed values: json, jsonc, table, tsv. Default: json.
--query : JMESPath query string. See http://jmespath.org/ for more information and
examples.
--verbose : Increase logging verbosity. Use --debug for full debug logs.
Examples
Delete a VM without a prompt for confirmation.
az vm delete -g MyResourceGroup -n MyVm --yes
Delete a virtual machine by Ids
az vm delete --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
azure on Linux (Ubuntu 14.04)
$ azure --version
0.10.13 (node: 0.10.25)
$ azure vm delete --help
help: Delete a virtual machine in a resource group
help:
help: Usage: vm delete [options] <resource-group> <name>
help:
help: Options:
help: -h, --help output usage information
help: -v, --verbose use verbose output
help: -vv more verbose with debug output
help: --json use json output
help: -g, --resource-group <resource-group> the resource group name
help: -n, --name <name> the virtual machine name
help: -q, --quiet quiet mode, do not ask for delete confirmation
help: -s, --subscription <subscription> the subscription identifier
help:
help: Current Mode: arm (Azure Resource Management)
@joergrech Thanks for the logs. Please refer to my previous comments.
azure on MacOS Sierra 10.12.5 is in the old ASM mode/stack.
azure on Linux (Ubuntu 14.04) is in the new ARM mode/stack.
You can use azure config mode -h to switch between.
For az program, it's not owned by the Compute team. And you need to create a new issue to @amarzavery . Thanks.
If you do not implement the delete-blob option in ARM - what is the proposed/"standard" way of handling the deletion of OSDisks?
- Retrieving the OSDisk by Name (
az vm show --name VM-Name --resource-group tw-crawler-west-europe --query "storageProfile.osDisk.name"), deleting the VM and then deleting the OSDisk?
or
- using the Manage Disk approach? NOTE: I have to check the benefits and drawbacks of this approach.
or
- any other way?
NOTE: Our problem with the first approach is that deleting the VM over the Azure-API requires 2-3 Minutes and we need to start and stop ~200 servers as fast as possible (with ASM we needed ~1 Minute per Server using the "--blob-delete" option - the new approach on ARM would require 2-3x more time)
Thanks @joergrech for the feedback & use case.
The --blob-delete option is provided by ASM service API for the VMs to address this use case in an efficient manner, but unfortunately this is missing from the ARM stack. Approaching this problem in the client side is unlikely achieving the time constraint you expect to solve.
I mark this issue as a ServiceIssue because of this is a mising parity feature. I will sync up with the teams and let you know. Thanks.
Again, I can't answer the az questions. Sorry.
@joergrech Update --- Overall, moving to ARM from ASM should still give you the maximized benefits in terms of new features.
For your asks ---
-
Confirmed --
azure vmss deletewill delete the managed disks belonging to VMs, because the REST API behind this command supports it; -
To be done: ---
azure vmdeletion will not delete the blob/disk artifacts by default in 1 operation, and it's a TODO & parity item. And I don't have the data for using multiple operations to accomplish the same use case. -
In ARM, if you delete the resource group, VM/Network/Storage artifacts are deleted all together, so if you can aligned the VM deletion with the group deletion, I believe you can achieve the use case you described. For more, please look at:
azure group -h.
Issue opened soon to be 2 years ago, and I can not see any progress having been done on this end?