Search This Blog

Sunday, October 4, 2015

Add a Range of Endpoint Port on Azure Virtual Machine


On Azure Management Portal, we can add a single endpoint port. Now how do we add a range of endpoint port that need to open?

Well, the only way that you can do it is by using Azure Powershell by here is an example on how we open endpoint port range from 60000 – 60030 for a particular VM

[ Configuration]

1. Identify VM Service Name and Name by using Get-AzureVM

2. Enter the following command

$vm = Get-AzureVM -ServiceName (yourvmservicename) -Name (yourvmname) ; 60000..60030 | ForEach { $VM | Add-AzureEndpoint -Name TestEndpoint$_ -Protocol TCP -LocalPort $_ -PublicPort $_} ; $vm | Update-AzureVM

$vm = Get-AzureVM -ServiceName "kl-ms4u-dc1" -Name "kl-ms4u-dc1" ; 60000..60030 | ForEach { $VM | Add-AzureEndpoint -Name EndpointPort$_ -Protocol TCP -LocalPort $_ -PublicPort $_} ; $vm | Update-AzureVM


Verify on Azure Management Portal :


Voila! 30 endpoint ports has added.