Create a virtual machine with a static public IP address using the Azure portal

You can create a virtual machine with a static public IP address. A public IP address enables you to communicate to a virtual machine from the internet. Assign a static public IP address, rather than a dynamic address, to ensure that the address never changes. Learn more about static public IP addresses. To change a public IP address assigned to an existing virtual machine from dynamic to static, or to work with private IP addresses, see Add, change, or remove IP addresses. Public IP addresses have a nominal charge, and there is a limit to the number of public IP addresses that you can use per subscription.

Sign in to Azure

Sign in to the Azure portal at

Create a virtual machine

  1. Select + Create a resource found on the upper, left corner of the Azure portal.

  2. Select Compute, and then select Windows Server 2016 VM, or another operating system of your choosing.

  3. Enter, or select, the following information, accept the defaults for the remaining settings, and then select OK:

    Setting Value
    Name myVM
    User name Enter a user name of your choosing.
    Password Enter a password of your choosing. The password must be at least 12 characters long and meet the defined complexity requirements.
    Subscription Select your subscription.
    Resource group Select Use existing and select myResourceGroup.
    Location Select East US
  4. Select a size for the VM and then select Select.

  5. Under Settings, select Public IP address.

  6. Enter myPublicIpAddress, select Static, and then select OK, as shown in the following picture:

    Select static

    If the public IP address must be a standard SKU, select Standard under SKU. Learn more about Public IP address SKUs. If the virtual machine will be added to the back-end pool of a public Azure Load Balancer, the SKU of the virtual machine's public IP address must match the SKU of the load balancer's public IP address. For details, see Azure Load Balancer.

  7. Select a port, or no ports under Select public inbound ports. Portal 3389 is selected, to enable remote access to the Windows Server virtual machine from the internet. Opening port 3389 from the internet is not recommended for production workloads.

    Select a port

  8. Accept the remaining default settings and select OK.

  9. On the Summary page, select Create. The virtual machine takes a few minutes to deploy.

  10. Once the virtual machine is deployed, enter myPublicIpAddress in the search box at the top of the portal. When myPublicIpAddress appears in the search results, select it.

  11. You can view the public IP address that is assigned, and that the address is assigned to the myVM virtual machine, as shown in the following picture:

    View public IP address

    Azure assigned a public IP address from addresses used in the region you created the virtual machine in. You can download the list of ranges (prefixes) for the Azure Public, US government, China, and Germany clouds.

  12. Select Configuration to confirm that the assignment is Static.

    View public IP address


Do not modify the IP address settings within the virtual machine's operating system. The operating system is unaware of Azure public IP addresses. Though you can add private IP address settings to the operating system, we recommend not doing so unless necessary, and not until after reading Add a private IP address to an operating system.

Clean up resources

When no longer needed, delete the resource group and all of the resources it contains:

  1. Enter myResourceGroup in the Search box at the top of the portal. When you see myResourceGroup in the search results, select it.
  2. Select Delete resource group.
  3. Enter myResourceGroup for TYPE THE RESOURCE GROUP NAME: and select Delete.

Next steps