Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Bulk-Add Azure endpoints?

I've got an FTP server running on Azure. I had to manually add in 20 endpoints for the 'data' connection.

It was painful.

Why is it so hard!!!

Surely there's a better way to bulk add endpoints to an Azure VM, somehow? If so, could someone list some instructions? I'm open to anything.

eg. I would love to create

TCP public port 61020 - private port 61020

to

TCP public port 61100 - private port 61100

hmmm....

like image 451
Pure.Krome Avatar asked May 15 '14 11:05

Pure.Krome


Video Answer


1 Answers

You can do this with PowerShell. A just tested script:

Add-AzureAccount
Select-AzureSubscription -SubscriptionName "Your_Subscription_Name"
$vm = Get-AzureVM -ServiceName "CloudServiceName" -Name "VM_Name"
for ($i=6100; $i -le 6120; $i++)
{
    $EndpointName = "FtpEndpoint_"
    $EndpointName += $i
    Add-AzureEndpoint -Name $EndpointName -Protocol "tcp" -PublicPort $i -LocalPort $i -VM $vm
}
$vm | Update-AzureVM

The actuall service call is performed at bulk when you execute the Update-AzureVM

Starting point for Azure PowerShell reference is here.

I am sure you can achieve the same result also with the XPLAT-CLI.

like image 69
astaykov Avatar answered Oct 17 '22 12:10

astaykov