Quantcast
Channel: Fabric Controller» Windows Azure Virtual Machines
Viewing all articles
Browse latest Browse all 15

Adding multiple endpoints to your Windows Azure Virtual Machines by using a CSV file

$
0
0

In order to manage endpoints of a Virtual Machine you have 2 options: use the portal or use Powershell. If you use the portal it’s not so easy to add a list or a range or ports, you would need to add these ports one by one. The other way you can manage these endpoints is by writing Powershell scripts and that’s what I did over and over again for the past few months.

What I wanted was some way to easily add endpoints to newly created Virtual Machines. A CSV file would be perfect for this. It’s easy to manage (in Excel for example) and you can create different templates to improve reusability. That’s why I created the Import-AzureEndpointsFromCSV.ps1 script.

With this script you can import 2 types of endpoints:

  • Normal endpoints (not load-balanced)
  • Load-balanced endpoints

Creating a CSV file

So what you would do first is create the endpoints in CSV format. By using Excel it’s actually very easy to duplicate the defined endpoints by dragging the cells down (but you can also use Notepad or any other text editor). The normal endpoints are defined by these columns: Name, Protocol, PublicPort, LocalPort.

The load balanced endpoints need a little more information: Name, Protocol, PublicPort, LocalPort, LBSetName, ProbePort, ProbeProtocol, ProbePath

After defining the endpoints, simply export to a CSV file:

Importing the CSV file

Calling the script and importing the CSV file is very easy. You simply call the script and pass the required parameters:

  • The virtual machine
  • The filename of the CSV file
  • The type of CSV file: NoLB or LoadBalanced

In case you want to add load-balanced endpoints you will need to add those to each virtual machine in the cloud service.

After importing the endpoints you’ll see them showing up in the portal:

And after you imported the load-balanced endpoints for all your machines in the same cloud service you’ll see that these endpoints show up as being load balanced:

The script and the sample CSV files are available on GitHub.


Viewing all articles
Browse latest Browse all 15

Trending Articles