You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-network/ip-services/configure-routing-preference-virtual-machine.md
+68-14Lines changed: 68 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: 'Tutorial: Configure routing preference for a virtual machine'
3
3
description: Learn how to create a virtual machine with a public IP address with routing preference choice using the Azure portal.
4
-
ms.date: 12/11/2024
4
+
ms.date: 02/24/2026
5
5
ms.author: mbender
6
6
author: mbender-ms
7
7
ms.service: azure-virtual-network
@@ -43,25 +43,45 @@ If you choose to install and use PowerShell locally, this article requires the A
43
43
44
44
---
45
45
46
-
## Create virtual machine with a public IP address
47
-
48
46
# [Azure portal](#tab/azure-portal)
49
47
50
-
In this section, you create a virtual machine and public IP address in the Azure portal. During the public IP address configuration, you select **Internet** for routing preference.
48
+
## Create a resource group
51
49
52
50
1. Sign in to the [Azure portal](https://portal.azure.com).
53
51
54
-
2. In the portal search box, enter **Virtual machine**. In the search results, select **Virtual machines**.
52
+
2. In the portal search box, enter **Resource groups**. In the search results, select **Resource groups**.
53
+
54
+
3. Select **+ Create**.
55
+
56
+
4. In the **Basics** tab of **Create a resource group**, enter, or select the following information.
57
+
58
+
| Setting | Value |
59
+
| ------- | ----- |
60
+
|**Project details**||
61
+
| Subscription | Select your subscription. |
62
+
| Resource group | Enter **TutorVMRoutePref-rg**. |
63
+
|**Resource details**||
64
+
| Region | Select **(US) West US 2**. |
65
+
66
+
5. Select **Review + create**.
67
+
68
+
6. Select **Create**.
69
+
70
+
## Create virtual machine with a public IP address
71
+
72
+
In this section, you create a virtual machine and public IP address in the Azure portal. During the public IP address configuration, you select **Internet** for routing preference.
73
+
74
+
1. In the portal search box, enter **Virtual machine**. In the search results, select **Virtual machines**.
55
75
56
-
3. In **Virtual machines**, select **+ Create**, then **+ Virtual machine**.
76
+
2. In **Virtual machines**, select **+ Create**, then **+ Virtual machine**.
57
77
58
-
4. In the **Basics** tab of **Create a virtual machine**, enter, or select the following information.
78
+
3. In the **Basics** tab of **Create a virtual machine**, enter, or select the following information.
59
79
60
80
| Setting | Value |
61
81
| ------- | ----- |
62
82
|**Project details**||
63
83
| Subscription | Select your subscription. |
64
-
| Resource group | Select **Create new**.</br> Enter **TutorVMRoutePref-rg**. Select **OK**. |
84
+
| Resource group | Select **TutorVMRoutePref-rg**. |
65
85
|**Instance details**||
66
86
| Virtual machine name | Enter **myVM**. |
67
87
| Region | Select **(US) West US 2**. |
@@ -77,12 +97,14 @@ In this section, you create a virtual machine and public IP address in the Azure
77
97
| Password | Enter a password. |
78
98
| Confirm password | Reenter password. |
79
99
|**Inbound port rules**|
80
-
| Public inbound ports | Select **Allow selected ports**. |
81
-
| Select inbound ports | Leave the default of **RDP (3389)**.</br> _**Opening port 3389 from the internet is not recommended for production workloads**_. |
100
+
| Public inbound ports | Select **None**. |
101
+
102
+
> [!NOTE]
103
+
> All public inbound ports are closed for this virtual machine. To manage your virtual machines, deploy Azure Bastion. For more information, see [Quickstart: Deploy Azure Bastion from the Azure portal](../../bastion/quickstart-host-portal.md).
82
104
83
-
5. Select **Next: Disks** then **Next: Networking**, or select the **Networking** tab.
105
+
4. Select **Next: Disks** then **Next: Networking**, or select the **Networking** tab.
84
106
85
-
6. In the networking tab, enter or select the following information.
107
+
5. In the networking tab, enter or select the following information.
86
108
87
109
| Setting | Value |
88
110
| ------- | ----- |
@@ -91,9 +113,9 @@ In this section, you create a virtual machine and public IP address in the Azure
91
113
| Subnet | Leave the default of **(new) default (10.1.0.0/24)**. |
92
114
| Public IP | Select **Create new**.</br> In **Name**, enter **myPublicIP**.</br> In **Routing preference**, select **Internet**.</br> In **Availability zone**, select **Zone 1**.</br> Select **OK**. |
93
115
94
-
7. Select **Review + create**.
116
+
6. Select **Review + create**.
95
117
96
-
8. Select **Create**.
118
+
7. Select **Create**.
97
119
98
120
# [Azure CLI](#tab/azure-cli)
99
121
@@ -109,6 +131,19 @@ Create a resource group with [az group create](/cli/azure/group#az-group-create)
109
131
--location westus2
110
132
```
111
133
134
+
## Create a network security group
135
+
136
+
Create a network security group with [az network nsg create](/cli/azure/network/nsg#az-network-nsg-create). The default rules in the network security group deny all inbound access from the internet.
137
+
138
+
```azurecli-interactive
139
+
az network nsg create \
140
+
--resource-group TutorVMRoutePref-rg \
141
+
--name myNSG
142
+
```
143
+
144
+
> [!NOTE]
145
+
> All public inbound ports are closed for this virtual machine. To manage your virtual machines, deploy Azure Bastion. For more information, see [Quickstart: Deploy Azure Bastion from the Azure portal](/azure/bastion/quickstart-host-portal).
146
+
112
147
## Create a public IP address
113
148
114
149
Use [az network public-ip create](/cli/azure/network/public-ip#az-network-public-ip-create) to create a standard zone-redundant public IPv4 address named **myPublicIP** in **TutorVMRoutePref-rg**. The **Tag** of **Internet** is applied to the public IP address as a parameter in the CLI command enabling the **Internet** routing preference.
Create a network security group with [New-AzNetworkSecurityGroup](/powershell/module/az.network/new-aznetworksecuritygroup). The default rules in the network security group deny all inbound access from the internet.
194
+
195
+
```azurepowershell-interactive
196
+
## Create network security group. ##
197
+
$nsg = @{
198
+
Name = 'myNSG'
199
+
ResourceGroupName = 'TutorVMRoutePref-rg'
200
+
Location = 'westus2'
201
+
}
202
+
New-AzNetworkSecurityGroup @nsg
203
+
```
204
+
205
+
> [!NOTE]
206
+
> All public inbound ports are closed for this virtual machine. To manage your virtual machines, deploy Azure Bastion. For more information, see [Quickstart: Deploy Azure Bastion from the Azure portal](/azure/bastion/quickstart-host-portal).
207
+
155
208
## Create a public IP address
156
209
157
210
Use [New-AzPublicIpAddress](/powershell/module/az.network/new-azpublicipaddress) to create a standard zone-redundant public IPv4 address named **myPublicIP** in **TutorVMRoutePref-rg**. The **Tag** of **Internet** is applied to the public IP address as a parameter in the PowerShell command enabling the **Internet** routing preference.
0 commit comments