lib/azure/armrest/virtual_machine_service.rb
# Delete the VM and associated resources. By default, this will
# delete the VM, its NIC, the associated IP address, and the
# image files (.vhd and .status) for the VM.
#
# If you want to delete other associated resources, such as any
# attached disks, the VM's underlying storage account, or associated
# network security groups you must explicitly specify them as an option.
#
# An attempt to delete a resource that cannot be deleted because it's
# still associated with some other resource will be logged and skipped.
#
# If the :verbose option is set to true, then additional messages are
# sent to your configuration log, or stdout if no log was specified.
#
# Note that if all of your related resources are in a self-contained
# resource group, you do not necessarily need this method. You could
# just delete the resource group itself, which would automatically
# delete all of its resources.
#
Delete the VM and associated resources. By default, this will
delete the VM, its NIC, the associated IP address, and the
image files (.vhd and .status) for the VM.

If you want to delete other associated resources, such as any
attached disks, the VM's underlying storage account, or associated
network security groups you must explicitly specify them as an option.

An attempt to delete a resource that cannot be deleted because it's
still associated with some other resource will be logged and skipped.

If the :verbose option is set to true, then additional messages are
sent to your configuration log, or stdout if no log was specified.

Note that if all of your related resources are in a self-contained
resource group, you do not necessarily need this method. You could
just delete the resource group itself, which would automatically
delete all of its resources.
Delete the VM and associated resources . By default this will delete the VM its NIC the associated IP address and the image files ( . vhd and . status ) for the VM . If you want to delete other associated resources such as any attached disks the VM ' s underlying storage account or associated network security groups you must explicitly specify them as an option . An attempt to delete a resource that cannot be deleted because it ' s still associated with some other resource will be logged and skipped . If the : verbose option is set to true then additional messages are sent to your configuration log or stdout if no log was specified . Note that if all of your related resources are in a self - contained resource group you do not necessarily need this method . You could just delete the resource group itself which would automatically delete all of its resources .
def delete_associated_resources(vmname, vmgroup, options = {})
        options = {
          :network_interfaces      => true,
          :ip_addresses            => true,
          :os_disk                 => true,
          :data_disks              => false,
          :network_security_groups => false,
          :storage_account         => false,
          :verbose                 => false
        }.merge(options)
        Azure::Armrest::Configuration.log ||= STDOUT if options[:verbose]
        vm = get(vmname, vmgroup)
        delete_and_wait(self, vmname, vmgroup, options)
        if options[:network_interfaces] || options[:ip_addresses] || options[:network_security_groups]
          delete_associated_nics(vm, options)
        end
        if options[:os_disk] || options[:storage_account]
          delete_associated_disk(vm, options)
        end
        if options[:data_disks]
          delete_associated_data_disks(vm, options)
        end
      end
def delete_associated_resources ( vmname , vmgroup , options = { } ) options = { :network_interfaces => true , :ip_addresses => true , :os_disk => true , :data_disks => false , :network_security_groups => false , :storage_account => false , :verbose => false } . merge ( options ) Azure :: Armrest :: Configuration . log ||= STDOUT if options [ :verbose ] vm = get ( vmname , vmgroup ) delete_and_wait ( self , vmname , vmgroup , options ) if options [ :network_interfaces ] || options [ :ip_addresses ] || options [ :network_security_groups ] delete_associated_nics ( vm , options ) end if options [ :os_disk ] || options [ :storage_account ] delete_associated_disk ( vm , options ) end if options [ :data_disks ] delete_associated_data_disks ( vm , options ) end end
Delete the VM and associated resources.
Delete the VM and associated resources .
# Must delete network interfaces first if you want to delete # IP addresses or network security groups.
vmname
<not_specific>
vmgroup
<not_specific>
options
<not_specific>