Configure a Static IP in Azure
Configure a Static IP in Azure
by Jeff on August 6th, 2014 No Comments »

Due to the nature Azure and high availability, it is more than cumbersome to configure a static IP in Azure.

I was in need of spinning up a domain controller in the Azure cloud platform. This setup required me to configure a static IP in Azure, a task that one would think is simple. A majority of the cloud providers that I have worked with have an option in the GUI to set a Static IP Address, not Azure. According to the Microsoft Documentation, PoweShell must be used to configure a static IP in Azure, no GUI option. Since this was my first experience with Windows Azure, I was pretty lost. After several hours of playhing around, I was finally able to configure a static IP in Azure using the PowerShell CMDlets, and here’s how.

Required Items

  1. Azure Subscription Name
  2. Service Name
  3. Azure VM Name
  4. Azure Network Name
  5. Static IP Address (This example uses

Azure Subscription Name And VM Name

From your Azure Portal, click the “Virtual Machines” menu icon.
Azure Virtual Machines Menu

In the “virtual machines” list, document the “Subscription Name”. In this example, the Subscription Name is “TestSubscription” and the VM name is “Server01”


Service Name

This article assumes you only have one Service created. If you have more, you will need to dig deeper to find out which service the VM belongs to. I am using Service01 in this example

From your Azure Portal, click the “Cloud Services” menu icon.

In the Cloud Services List, find our Service Name

Azure Network Name

From your Azure Portal, click the “Networks” menu icon.

In the “Networks” list, find the “Name” that corresponds to your Subscription. In this example, the Network Name is “Network01”

Import Azure Published Settings

PowerShell is the only way to configure a static IP in Azure. The good news is that Microsoft makes it fairly simply to connect to your Azure VMs via PowerShell. You must first install the Windows Azure PowerShell client via WebPI. Once installed, launch PowerShell to continue

Download the Published Settings File
To import the Azure Published Settings File, enter the following into PowerShell

PS C:\> Get-AzurePublishSettingsFile

This will launch the Azure Platform Portal where you can download your Published Settings File. This file will have the file extension of .publishsettings. Save this file to location that you will remember and continue. For this example I will save the file to the root of my C:\ Drive and named Azure.publishedsettings

Import the Published Settings File

PS C:\> Import-AzurePublishedSettingsFile "C:\Azure.publishedsettings"

Verify that your Subscription Imported

PS C:\> Get-AzureSubscription

You should see a dump of subscriptions. Ensure that your subscription is there and that there is an associated SubscriptionId

Check if the Static IP is Available

I am using the IP of for this example. You should pick an IP from your proper IP range associated with your Network

PS C:\> Test-AzureStaticVNetIP -VNetName Network01 -IPAddress
VERBOSE: 1:37:33 PM - Begin Operation: Test-AzureStaticVNetIP
VERBOSE: 1:37:36 PM - Completed Operation: Test-AzureStaticVNetIP

IsAvailable          : True
AvailableAddresses   : {}
OperationDescription : Test-AzureStaticVNetIP
OperationId          : 9a58b56d-3c8f-cf24-8e13-0ab882a8e2f7
OperationStatus      : Succeeded

The “IsAvailable” field indicates whether the IP is available to configure as static.

Assign the Static IP

PS C:\> Get-AzureVM -ServiceName Service01 -Name Server01 | Set-AzureStaticVNetIP -IPAddress | Update-AzureVM
VERBOSE: 1:39:13 PM - Completed Operation: Get Deployment
VERBOSE: 1:39:14 PM - Completed Operation: Get Deployment
VERBOSE: 1:39:14 PM - Begin Operation: Update-AzureVM
VERBOSE: 1:39:46 PM - Completed Operation: Update-AzureVM

OperationDescription                    OperationId                             OperationStatus
--------------------                    -----------                             ---------------
Update-AzureVM                          567a392f-99ba-c636-82db-df2102e55440    Succeeded

Leave a Reply

Your email address will not be published. Required fields are marked *