Skip to content

Instantly share code, notes, and snippets.

@rsponholtz
Created June 18, 2018 15:59
Show Gist options
  • Save rsponholtz/ca9c325c68202714f6273e325d43ead8 to your computer and use it in GitHub Desktop.
Save rsponholtz/ca9c325c68202714f6273e325d43ead8 to your computer and use it in GitHub Desktop.
delete unused disks in azure
$subscriptionname = "mysubscription"
$resourcegroup = "myresourcegroup"
select-azurermsubscription -subscriptionname $subscriptionname
Get-AzureRmDisk -ResourceGroupName $resourcegroup | Where-Object {$_.ManagedBy -eq $Null} | remove-azurermdisk -force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment