• 2 min read

Static Internal IP Address for Virtual Machines

What is it? With the most recent PowerShell release, you now have the capability to define and configure a specific internal IP address that can be statically assigned to an IaaS Virtual Machine…

What is it?

With the most recent PowerShell release, you now have the capability to define and configure a specific internal IP address that can be statically assigned to an IaaS Virtual Machine deployed in a Virtual Network. This feature will allow you to directly configure the internal IP address for your Virtual Machine and maintain it even when stopping and starting the Virtual Machine. You can even delete the Virtual Machine and redeploy it months later and keep the same IP address.

When would you use it?

If you have recently deployed an Active Directory Domain Controller on a Virtual Machine in Azure, you probably have been struggling to deploy the VM, discover the IP address and then insert that IP address as the DNS server for the other VMs in your Virtual Network. Most of our content and communication asks you to assume the first IP in a given subnet is always the .4 address (10.0.0.4 in the 10.0.0.0 subnet). No longer do you need to take this weird assumption and now you can directly select the internal IP address for the AD/DNS VM and hold it statically, to use this for your DNS internal IP address so your other VMs can easily connect. You can even continue to persist the internal IP even when you stop your AD VM and re-use it on the next start.

How do I use it?

The following sample illustrates the creation of a VM (StaticIPVM) into my SharePoint VNET (SPAutoVNET) with the IP address of 10.20.1.30.

Here is what the portal looks like after deploying this VM:

You can also retrieve the static IPs you have assigned using the Get-AzureStaticVNETIP command in PowerShell. As is always the case, you can leverage the help content in PowerShell to discover the different ways these settings can be used and piped.

In this below example, you will see the updates I recently made to the SharePoint farm scripts that will take the IP address for the VM deployed as the AD/DNS server and make sure to set that IP address statically, to avoid losing it later. This resetting of the IP as static MIGHT cause a reboot of the VM.

Looking for further documentation? Check it out here:

 

See ya around,

Corey