Using Fixed IP in Virtual Machines on Windows Azure
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.
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:
To verify that imported successfully use the command Get-AzureSubscription that returns the registered data:
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:
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:
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:
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:
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:
Finally, while checking the network scope in Azure, you can see that the machines were fixed IP resumed: