naviat
12/7/2017 - 8:02 AM

AzureVMConfigXML.ps1

$subscription = "[Subscription here]" 

Select-AzureSubscription -SubscriptionName $subscription

$cloudservice = '[Cloud Service Here]'

Get-AzureVM -ServiceName $cloudservice | foreach { 
    $path = 'c:\vms' + $_.Name + '.xml'
    Export-AzureVM -ServiceName $cloudservice -Name $_.Name -Path $path
}
# Faster way of removing all VMs while keeping the cloud service/DNS name 
#Remove-AzureDeployment -ServiceName $cloudservice -Slot Production -Force