Mark Minasi's Tech Forum
Register Calendar Latest Topics Chat
 
 
 


Reply
  Author   Comment  
Mark

Hacked Mark's Facebook Account
Registered:
Posts: 261
Reply with quote  #1 
When I teach my PowerShell class, I use Azure to spin up a bunch of domain controllers -- I have a base image VHD, and the module copies that VHD some number of times, registering them as "Azure OS disks" and building VMs from there.

Sometimes, though, after I've run the cmdlet that deletes them, I've got a pile of VHDs still costing me storage.

The problem is that you can't delete the VHD associated with a given AzureDisk until the AzureDisk has been deleted.  So just remove-AzureDisk any remaining AzureDisks, and the deletes go well.  I hope this makes someone's life a little easier some time!

__________________
May I ask that everyone please populate the first name and last name in your user account profile.  Thanks!
0
ukinahan

New Friend (or an Old Friend who Built a New Account)
Registered:
Posts: 19
Reply with quote  #2 
Great pointer Mark, just to add to this sometime you may get a message back (or not) that the lease is still in place and you need to break that lease to move forward. In order to do so you can use the following example to break that lease and stop getting charged!;

ARM Model -
Get-AzureRmStorageAccount -ResourceGroupName <resource group name> -Name <storage account name> | Get-AzureStorageBlob -Blob <blob name> -Container <container name>[wink].ICloudBlob.BreakLease()

Or avail of the following script which is quite handy - https://gallery.technet.microsoft.com/scriptcenter/How-to-break-the-locked-c2cd6492

0
Mark

Hacked Mark's Facebook Account
Registered:
Posts: 261
Reply with quote  #3 
Thanks, Ultan! As you say, this contruction works well even on ASM VMs:


(Get-AzureStorageBlob 'F.vhd' vhds).ICloudBlob.BreakLease()



__________________
May I ask that everyone please populate the first name and last name in your user account profile.  Thanks!
0
wobble_wobble

Avatar / Picture

Associate Troublemaker Apprentice
Registered:
Posts: 741
Reply with quote  #4 
This just saved me a head scratch 
__________________
Have you tried turning it off and walking away? The next person can fix it!

New to the forum? Read this
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation: