Skip to content

Using Fixed IP in Virtual Machines on Windows Azure

03/11/2014

A new feature that became available in new versions of PowerShell for Windows Azure are the commands "StaticVNetIP". You can download the new version at http://www.windowsazure.com/pt-br/downloads/online #cmd-tools

These commands allow you to attach the IP within the range of virtual network that you have already defined, thus allowing can ensure the IP of each VM without the need to make the "Start" in the fixed order every time.

Step 1: know the risks and Manage Their IPs

Before we begin, it is important to note that there is support if problems arise (http://msdn.microsoft.com/en-us/library/windowsazure/jj156090.aspx#BKMK_IPAddressDNS):

"Use DHCP-leased addresses (this is mandatory — static addresses are NOT supported)

Therefore, before you begin to designate fixed IPs their VMs, remember to keep a list of IPs defined!

In addition, do not use IPs that are not in the range of your virtual network. For example, my network has the range to 254 10.0.1.4 and if I fix the IP 10.0.2.4 to a VM, it will be incommunicado and need to be excluded.

image

 

Step 2: Register the Signature in PowerSell

This step is permanent, and simply run the command Add-AzureAccount which will open a window of authentication and import the data from your signature:

Capture

To verify that imported successfully use the command Get-AzureSubscription that returns the registered data:

image

If you need to remove a subscription that has used in the past to test the command Remove-AzureSubscription is indicated. If necessary, you will need to reset your default signature, the command below will reset the default:

image

 

Step 3: Register the IP of Each VM

To register the IPs remember what was commented at the beginning, it is necessary that they are in the range of virtual network that you have defined, otherwise the VM can no longer be accessed and will be incommunicado.

The command you use to secure the IP does not work with strings, the first step is to use the command Get-AzureVM to return in a variable the PermanentID the VM you want:

image

The above command searches for the VM "W2012-Exch-3" in the catalog and returns the ID, and the command Set-AzureStaticVNetIP below the fixed IP:

image

Note: you can use the "pipe |" to run the commands on the same line if desired

However, note that the above command was not confirmed, just like that. The correct way is to use the Update-AzureVM in sequence to confirm the change, as a commit.

Thus, the sequence of commands to change the VMs would have been like the example below:

image

Note that in this example 3 different VMs have had their fixed and IPs is possible with the command Get-AzureStaticVNetIP see if the VM set the desired IP:

image

Finally, while checking the network scope in Azure, you can see that the machines were fixed IP resumed:

ListaIPs

Advertisements
2 Comments
  1. Quality articles is the main to be a focus for the people to go to see the web page, that’s what this website is providing.

  2. Great items from you, man. I’ve keep in mind your stuff prior
    to and you’re simply too great. I actually like what you have got right
    here, really like what you’re stating and the best way
    wherein you assert it. You are making it enjoyable and you still care
    for to stay it sensible. I can not wait to read far more from you.
    That is actually a wonderful web site.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: