Bulk-Adding Endpoints to an Azure VM
I had to create a large number of EndPoints for an Azure VM.
Here's the powershell script I used. HTH.
Add-AzureAccount
(and then enter your username/password in the 'popup' box)
then create a powershell file .. eg. addEndPoints.ps1
Select-AzureSubscription -SubscriptionName "----------"
$vm = Get-AzureVM -ServiceName "service-name-here" -Name "vm-name-here"
$startEndPoint = 62000
$endEndPointRange = 100
for ($i=1; $i -lt $endEndPointRange; $i++)
{
$EndpointName = "FTP Data "
$EndpointName += $i
$localPort = $startEndPoint + $i
#Write-Output $EndpointName
#Write-Output $localPort
Add-AzureEndpoint -Name $EndpointName -Protocol "tcp" -PublicPort $localPort -LocalPort $localPort -VM $vm
}
$vm | Update-AzureVM
To find out which subscription to use, type
Get-AzureSubscription
To find out the VM's Service Name and VM's Name, type
Get-AzureVM
after you've added your account AND selected your subscription. (That lists all the vm's for a subscription).
This script was heavily based upon this answer from my StackOverflow question.
Written by Pure Krome
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Azure
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#