Sunday, 29 March 2015

TFS on Azure – 03. Assign Internal Static IP for Azure VM

It is required to setup a internal static IP for Azure VM before promoting it as a Domain Controller or before setting up TFS/RM server etc. on Azure VM. This is required since Azure VM when shut down de-allocates its assigned IP and next time will be assigned with a different internal IP.
To set up internal static IP it is required to install Azure PowerShell in the local machine. Downloads available here.

Install Azure PowerShell.
19

Web Platform Installer will download and install Microsoft Azure PowerShell with Azure SDK.
20
 21
22


Installation of Azure PowerShell completed.
23

Launch Azure PoweShell.
24

Test IP address availability in Azure Virtual Network with following command.
Test-AzureStaticVNetIP –VNetName VirtualNetworkName –IPAddress IP
Example
Test-AzureStaticVNetIP –VNetName chaminda.vn –IPAddress 10.0.0.4
This throw an exception if the Azure Subscription Account is not added in Azure PowerShell. To add Azure Account execute “Add-AzureAccount” command.
27

Sign in.
28

Subscription account will be added.
29

If required to change azure subscription name before adding the account follow the instructions available here.
Execution of Test-AzureStaticVNetIP succeeds after adding the account. It shows specified IP is available or not and available few IPs to use.
30

To set an static internal IP for Azure VM execute below command.
Get-AzureVM -ServiceName CloudServiceName -Name VMName | Set-AzureStaticVNetIP -IPAddress IPAddress | Update-AzureVM
Example
Get-AzureVM -ServiceName ch-dc1 -Name ch-dc1 | Set-AzureStaticVNetIP -IPAddress 10.0.0.5 | Update-AzureVM
26
31

This will set specified internal IP to the VM.
33

No comments: