|
| 1 | +--- |
| 2 | +title: Create a VM with a public IP address and set a routing preference choice with Azure portal | Microsoft Docs |
| 3 | +description: Learn how to create a VM with a public IP address using the Azure portal. |
| 4 | +services: virtual-network |
| 5 | +documentationcenter: na |
| 6 | +author: mnayak |
| 7 | +manager: |
| 8 | +editor: '' |
| 9 | +tags: azure-resource-manager |
| 10 | + |
| 11 | +ms.assetid: e9546bcc-f300-428f-b94a-056c5bd29035 |
| 12 | +ms.service: virtual-network |
| 13 | +ms.devlang: azurecli |
| 14 | +ms.topic: article |
| 15 | +ms.tgt_pltfrm: na |
| 16 | +ms.workload: infrastructure-services |
| 17 | +ms.date: 05/01/2020 |
| 18 | +ms.author: mnayak |
| 19 | + |
| 20 | +--- |
| 21 | +# Create a virtual machine with a static public IP address using the Azure portal |
| 22 | + |
| 23 | +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](virtual-network-ip-addresses-overview-arm.md#allocation-method). 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](virtual-network-network-interface-addresses.md). Public IP addresses have a [nominal charge](https://azure.microsoft.com/pricing/details/ip-addresses), and there is a [limit](../azure-resource-manager/management/azure-subscription-service-limits.md?toc=%2fazure%2fvirtual-network%2ftoc.json#azure-resource-manager-virtual-networking-limits) to the number of public IP addresses that you can use per subscription. |
| 24 | + |
| 25 | +## Sign in to Azure |
| 26 | + |
| 27 | +Sign in to the Azure portal at https://portal.azure.com. |
| 28 | + |
| 29 | +## Create a virtual machine |
| 30 | + |
| 31 | +1. Select **+ Create a resource** found on the upper, left corner of the Azure portal. |
| 32 | +2. Select **Compute**, and then select **Windows Server 2016 VM**, or another operating system of your choosing. |
| 33 | +3. Enter, or select, the following information, accept the defaults for the remaining settings, and then select **OK**: |
| 34 | + |
| 35 | + |Setting|Value| |
| 36 | + |---|---| |
| 37 | + |Name|myVM| |
| 38 | + |User name| Enter a user name of your choosing.| |
| 39 | + |Password| Enter a password of your choosing. The password must be at least 12 characters long and meet the [defined complexity requirements](../virtual-machines/windows/faq.md?toc=%2fazure%2fvirtual-network%2ftoc.json#what-are-the-password-requirements-when-creating-a-vm).| |
| 40 | + |Subscription| Select your subscription.| |
| 41 | + |Resource group| Select **Use existing** and select **myResourceGroup**.| |
| 42 | + |Location| Select **East US**| |
| 43 | + |
| 44 | +4. Select a size for the VM and then select **Select**. |
| 45 | +5. Under **Networking** tab, click on **Create new** for **Public IP address**. |
| 46 | +6. Enter *myPublicIpAddress*, select sku as **Standard**, and then select routing prefernce **Internet** and then hit **ok**, as shown in the following picture: |
| 47 | + |
| 48 | +  |
| 49 | + |
| 50 | +6. 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. |
| 51 | + |
| 52 | +  |
| 53 | + |
| 54 | +7. Accept the remaining default settings and select **OK**. |
| 55 | +8. On the **Summary** page, select **Create**. The virtual machine takes a few minutes to deploy. |
| 56 | +9. 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. |
| 57 | +10. 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: |
| 58 | + |
| 59 | +  |
| 60 | + |
| 61 | +11. Select **Networking** , then click on nic **mynic** and then click on the public ip address to confirm that the routing preference is assigned as **Internet**. |
| 62 | +  |
| 63 | + |
| 64 | +## Clean up resources |
| 65 | + |
| 66 | +When no longer needed, delete the resource group and all of the resources it contains: |
| 67 | + |
| 68 | +1. Enter *myResourceGroup* in the **Search** box at the top of the portal. When you see **myResourceGroup** in the search results, select it. |
| 69 | +2. Select **Delete resource group**. |
| 70 | +3. Enter *myResourceGroup* for **TYPE THE RESOURCE GROUP NAME:** and select **Delete**. |
| 71 | + |
| 72 | +## Next steps |
| 73 | + |
| 74 | +- Learn more about [public IP addresses](virtual-network-ip-addresses-overview-arm.md#public-ip-addresses) in Azure |
| 75 | +- Learn more about all [public IP address settings](virtual-network-public-ip-address.md#create-a-public-ip-address) |
0 commit comments