Quick Tip: Bulk removal of Azure Endpoints

September 09, 2015

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


Written by Richard Richard is an Office Apps & Services MVP (Teams / Skype) who lives in Minneapolis, MN. Microsoft Certified Solutions Master (MCSM) and MCSM Instructor - when those were a thing long ago. When not writing code, breaking teams - debate coach and avid golfer.
Follow on Twitter

Built using Gatsby and Material-UI

Copyright © TheArgyleMVP 2022.