Fix #409 by passing in storage account name to client as expected
Fix #273 by deleting the VM/Network Interface before deleting other networking resources, these errors were harmless and didn't actually lead to orphaned resources, but its noisy and unnecessary
Make it possible to unit test these new changes with substantial refactoring to step_deploy_template's CleanUp step, moving several of the resource deletions into their own functions.
Closes #409
Closes #273
Before this PR when building a VHD image with additional disks that should be deleted, you can see extra print statements at the bottom of 2, and my storage account as well as the failed additional disk deletion, and NIC repeated retry errors.
==> azure-arm:
==> azure-arm: Deleting Virtual Machine deployment and its attached resources...
==> azure-arm: Adding to deletion queue -> Microsoft.Compute/virtualMachines : 'replaced'
==> azure-arm: Adding to deletion queue -> Microsoft.Network/networkInterfaces : 'replaced'
==> azure-arm: Adding to deletion queue -> Microsoft.Network/virtualNetworks : 'replaced'
==> azure-arm: Adding to deletion queue -> Microsoft.Network/publicIPAddresses : 'replaced'
==> azure-arm: Waiting for deletion of all resources...
==> azure-arm: Attempting deletion -> Microsoft.Compute/virtualMachines : 'replaced'==> azure-arm: Attempting deletion -> Microsoft.Network/publicIPAddresses : 'replaced'
==> azure-arm: Attempting deletion -> Microsoft.Network/virtualNetworks : 'replaced'==> azure-arm: Attempting deletion -> Microsoft.Network/networkInterfaces : 'replaced'
==> azure-arm: Couldn't delete Microsoft.Network/publicIPAddresses resource. Will retry.
==> azure-arm: Name: replaced
==> azure-arm: Couldn't delete Microsoft.Network/virtualNetworks resource. Will retry.
==> azure-arm: Name: replaced
==> azure-arm: Attempting deletion -> Microsoft.Network/publicIPAddresses : 'replaced'
==> azure-arm: Attempting deletion -> Microsoft.Network/virtualNetworks : 'replaced'==> azure-arm: Skipping deletion -> image : 'https://removedstorageaccount.blob.core.windows.net/images/removed.vhd' since 'keep_os_disk' is set to true
==> azure-arm: Deleting Additional Disk -> 1: 'https://removedstorageaccount.blob.core.windows.net/images/pkrdisk-1.vhd'
==> azure-arm: Failed to delete the managed Additional Disk!
==> azure-arm: Deleting Additional Disk -> 2: 'https://removedstorageaccount.blob.core.windows.net/images/pkrdisk-2.vhd'
==> azure-arm: Failed to delete the managed Additional Disk!
==> azure-arm: Removing the created Deployment object: 'pkrdplafewlqjyv'
==> azure-arm:
==> azure-arm: The resource group was not created by Packer, not deleting ...
==> azure-arm: https://removedstorageaccount.blob.core.windows.net/
==> azure-arm: 2
Build 'azure-arm' finished after 3 minutes 6 seconds.
After
==> azure-arm: Deleting Virtual Machine deployment and its attached resources...
==> azure-arm: Deleted -> Microsoft.Compute/virtualMachines : 'pkrvmq58v6zr4b1'
==> azure-arm: Deleted -> Microsoft.Network/networkInterfaces : 'pkrniq58v6zr4b1'
==> azure-arm: Deleted -> Microsoft.Network/publicIPAddresses : 'pkripq58v6zr4b1'
==> azure-arm: Deleted -> Microsoft.Network/virtualNetworks : 'pkrvnq58v6zr4b1'
==> azure-arm: Skipping deletion -> image : 'https://removed.blob.core.windows.net/images/removed.vhd' since 'keep_os_disk' is set to true
==> azure-arm: Deleted Additional Disk -> 1: 'https://removed.blob.core.windows.net/images/removed-1.vhd'
==> azure-arm: Deleted Additional Disk -> 2: 'https://removed.blob.core.windows.net/images/removed-2.vhd'
==> azure-arm: Removing the created Deployment object: 'pkrdpq58v6zr4b1'
==> azure-arm:
==> azure-arm: The resource group was not created by Packer, not deleting ...
Build 'azure-arm' finished after 3 minutes 1 second.
This PR has three main purposes
Closes #409 Closes #273
Before this PR when building a VHD image with additional disks that should be deleted, you can see extra print statements at the bottom of 2, and my storage account as well as the failed additional disk deletion, and NIC repeated retry errors.
After