Create a VM with a static public IP address using the Azure portal

You can create virtual machines (VMs) in Azure and expose them to the public Internet by using a public IP address. By default, Public IPs are dynamic and the address associated to them may change when the VM is deleted or stopped/deallocated. To guarantee that the VM always uses the same public IP address, you need to create a static Public IP.

Before you can implement static Public IPs in VMs, it is necessary to understand when you can use static Public IPs, and how they are used. Read the IP addressing overview to learn more about IP addressing in Azure.

Note

Azure has two different deployment models for creating and working with resources: Resource Manager and classic. This article covers using the Resource Manager deployment model, which Microsoft recommends for most new deployments instead of the classic deployment model.

Scenario

This document will walk through a deployment that uses a static public IP address allocated to a virtual machine (VM). In this scenario, you have a single VM with its own static public IP address. The VM is part of a subnet named FrontEnd and also has a static private IP address (192.168.1.101) in that subnet.

You may need a static IP address for web servers that require SSL connections in which the SSL certificate is linked to an IP address.

IMAGE DESCRIPTION

You can follow the steps below to deploy the environment shown in the figure above.

Create a VM with a static public IP

To create a VM with a static public IP address in the Azure portal, complete the following steps:

  1. From a browser, navigate to the Azure portal and, if necessary, sign in with your Azure account.
  2. On the top left-hand corner of the portal, click Create a resource>>Compute>Windows Server 2012 R2 Datacenter.
  3. In the Select a deployment model list, select Resource Manager and click Create.
  4. In the Basics pane, enter the VM information as follows, and then click OK.

    Azure portal - Basics

  5. In the Choose a size pane, click A1 Standard as follows, and then click Select.

    Azure portal - Choose a size

  6. In the Settings pane, click Public IP address, then in the Create public IP address pane, under Assignment, click Static as follows. And, then click OK.

    Azure portal - Create public IP address

  7. In the Settings pane, click OK.
  8. Review the Summary pane, as follows, and then click OK.

    Azure portal - Create public IP address

  9. Notice the new tile in your dashboard.

    Azure portal - Create public IP address

  10. Once the VM is created, the Settings pane displays as follows:

    Azure portal - Create public IP address

Set IP addresses within the operating system

You should never manually assign the public IP address assigned to an Azure virtual machine within the virtual machine's operating system. It’s recommended that you do not statically assign the private IP assigned to the Azure virtual machine within the operating system of a VM, unless necessary, such as when assigning multiple IP addresses to a Windows VM. If you do manually set the private IP address within the operating system, ensure that it is the same address as the private IP address assigned to the Azure network interface, or you can lose connectivity to the virtual machine. Learn more about private IP address settings.

Next steps

Any network traffic can flow to and from the VM created in this article. You can define inbound and outbound security rules within a network security group that limit the traffic that can flow to and from the network interface, the subnet, or both. To learn more about network security groups, see Network security group overview.