Today we take a step outside the Skype for Business toy box and look at some PowerShell with Azure. The goal is easy, to bulk remove all associated EndPoints with a particular VM hosted in Azure. The most difficult part of this is simply waiting out all of the changes. What I discovered in trying to script this is you have to invoke the Update-AzureVM after each add/removal of an EndPoint. So if you are trying to remove or add a great number of EndPoints you should expect to wait – a long time.
$vm = Get-AzureVM -ServiceName “server01” -Name “server01”
$endpoints = Get-AzureEndpoint -VM $vm
foreach ($ep in $endpoints)
Remove-AzureEndpoint -VM $vm -Name ($ep.Name)
$vm | Update-AzureVM