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
@@ -23,19 +23,16 @@ A VM you create in the Azure portal has one NIC with default settings. You can c
23
23
To run the procedures in this article, you need the following prerequisites:
24
24
25
25
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
26
-
27
26
- An existing Azure virtual network. To create one, see [Quickstart: Create a virtual network by using the Azure portal](quick-create-portal.md).
28
-
29
27
- To run the following procedures, sign in to the [Azure portal](https://portal.azure.com) with your Azure account.
30
28
31
-
In the procedures, you can replace the example names with your own values.
29
+
In the procedures, you can replace the example names with your own values.
32
30
33
31
# [Azure CLI](#tab/azure-cli)
34
32
35
-
To run the procedures in this article, you need the following prerequisites:
33
+
To run the examples in this article, you need the following prerequisites:
36
34
37
35
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
38
-
39
36
- An existing Azure virtual network. To create one, see [Quickstart: Create a virtual network by using Azure CLI](quick-create-cli.md).
40
37
41
38
You can run the commands either in the [Azure Cloud Shell](/azure/cloud-shell/overview) or from Azure CLI on your computer.
@@ -46,16 +43,15 @@ You can run the commands either in the [Azure Cloud Shell](/azure/cloud-shell/ov
46
43
47
44
If you're prompted, install the Azure CLI extension on first use. For more information, [Use extensions with the Azure CLI](/cli/azure/azure-cli-extensions-overview).
48
45
49
-
Then run[az login](/cli/azure/reference-index#az-login) to connect to Azure. For more information, see [Sign in with Azure CLI](/cli/azure/authenticate-azure-cli).
46
+
Run[az login](/cli/azure/reference-index#az-login) to connect to Azure. For more information, see [Sign in with Azure CLI](/cli/azure/authenticate-azure-cli).
50
47
51
-
In the following procedures, you can replace the example placeholder names with your own values.
48
+
In the following code examples, you can replace the example placeholder names with your own values.
52
49
53
50
# [PowerShell](#tab/azure-powershell)
54
51
55
52
To run the procedures in this article, you need the following prerequisites:
56
53
57
54
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
58
-
59
55
- An existing Azure virtual network. To create one, see [Quickstart: Create a virtual network by using Azure PowerShell](quick-create-powershell.md).
60
56
61
57
You can run the commands either in the [Azure Cloud Shell](/azure/cloud-shell/overview) or from PowerShell on your computer.
@@ -68,13 +64,13 @@ You can run the commands either in the [Azure Cloud Shell](/azure/cloud-shell/ov
68
64
69
65
Then run `Connect-AzAccount` to connect to Azure. For more information, see [Sign in with Azure PowerShell](/powershell/azure/authenticate-azureps).
70
66
71
-
In the following procedures, you can replace the example placeholder names with your own values.
67
+
In the following code examples, you can replace the example placeholder names with your own values.
72
68
73
69
---
74
70
75
71
### Permissions
76
72
77
-
To work with NICs, your account must be assigned to the [network contributor](../role-based-access-control/built-in-roles.md?toc=%2fazure%2fvirtual-network%2ftoc.json#network-contributor) role or to a [custom role](../role-based-access-control/custom-roles.md?toc=%2fazure%2fvirtual-network%2ftoc.json) that is assigned the appropriate actions from the following list:
73
+
To work with NICs, your account must be assigned to the [network contributor](../role-based-access-control/built-in-roles.md?toc=%2fazure%2fvirtual-network%2ftoc.json#network-contributor) role or to a [custom role](../role-based-access-control/custom-roles.md?toc=%2fazure%2fvirtual-network%2ftoc.json) that's assigned the appropriate actions from the following list:
78
74
79
75
| Action | Name |
80
76
| --------- | ------------- |
@@ -102,7 +98,7 @@ The portal doesn't provide the option to assign the NIC to application security
102
98
103
99
To create a NIC, use the following procedure.
104
100
105
-
# [Portal](#tab/network-interface-portal)
101
+
# [Portal](#tab/azure-portal)
106
102
107
103
1. In the [Azure portal](https://portal.azure.com), search for and select *network interfaces*.
108
104
1. On the **Network interfaces** page, select **Create**.
@@ -112,7 +108,7 @@ To create a NIC, use the following procedure.
112
108
113
109
1. Select **Review + create**, and when validation passes, select **Create**.
114
110
115
-
# [Azure CLI](#tab/network-interface-cli)
111
+
# [Azure CLI](#tab/azure-cli)
116
112
117
113
The following example creates an Azure public IP address and associates it with the NIC.
118
114
@@ -139,7 +135,7 @@ The following example creates an Azure public IP address and associates it with
139
135
--public-ip-address myPublicIP
140
136
```
141
137
142
-
# [PowerShell](#tab/network-interface-powershell)
138
+
# [PowerShell](#tab/azure-powershell)
143
139
144
140
The following example creates an Azure public IP address and associates it with the NIC.
145
141
@@ -220,7 +216,7 @@ You can configure the following settings for a NIC:
220
216
221
217
You can view most settings for a NIC after you create it. The portal doesn't display the DNS suffix or application security group membership for the NIC. You can use Azure PowerShell or Azure CLI to view the DNS suffix and application security group membership.
222
218
223
-
# [Portal](#tab/network-interface-portal)
219
+
# [Portal](#tab/azure-portal)
224
220
225
221
1. In the [Azure portal](https://portal.azure.com), search for and select **Network interfaces**.
226
222
1. On the **Network interfaces** page, select the NIC you want to view.
@@ -256,7 +252,7 @@ You can view most settings for a NIC after you create it. The portal doesn't dis
256
252
257
253
:::image type="content" source="./media/virtual-network-network-interface/effective-routes.png" alt-text="Screenshot of effective routes.":::
258
254
259
-
# [Azure CLI](#tab/network-interface-cli)
255
+
# [Azure CLI](#tab/azure-cli)
260
256
261
257
Use [az network nic list](/cli/azure/network/nic#az-network-nic-list) to view all NICs in the subscription.
262
258
@@ -270,7 +266,7 @@ Use [az network nic show](/cli/azure/network/nic#az-network-nic-show) to view th
270
266
az network nic show --name myNIC --resource-group myResourceGroup
271
267
```
272
268
273
-
# [PowerShell](#tab/network-interface-powershell)
269
+
# [PowerShell](#tab/azure-powershell)
274
270
275
271
Use [Get-AzNetworkInterface](/powershell/module/az.network/get-aznetworkinterface) to view NICs in the subscription or view settings for a NIC.
276
272
@@ -292,7 +288,7 @@ You can change most settings for a NIC after you create it.
292
288
293
289
Azure DHCP assigns the DNS server to the NIC within the VM operating system. The NIC can inherit the settings from the virtual network, or use its own unique settings that override the setting for the virtual network. For more information about name resolution settings for a NIC, see [Name resolution for virtual machines](virtual-networks-name-resolution-for-vms-and-role-instances.md).
294
290
295
-
# [Portal](#tab/network-interface-portal)
291
+
# [Portal](#tab/azure-portal)
296
292
297
293
1. In the [Azure portal](https://portal.azure.com), search for and select **Network interfaces**.
298
294
1. On the **Network interfaces** page, select the NIC you want to change from the list.
@@ -310,7 +306,7 @@ Azure DHCP assigns the DNS server to the NIC within the VM operating system. The
310
306
311
307
1. Select **Save**.
312
308
313
-
# [Azure CLI](#tab/network-interface-cli)
309
+
# [Azure CLI](#tab/azure-cli)
314
310
315
311
Use [az network nic update](/cli/azure/network/nic#az-network-nic-update) to change the DNS server setting from inherited to a custom setting. Replace the DNS server IP addresses with your custom IP addresses.
316
312
@@ -330,7 +326,7 @@ az network nic update \
330
326
--dns-servers null
331
327
```
332
328
333
-
# [PowerShell](#tab/network-interface-powershell)
329
+
# [PowerShell](#tab/azure-powershell)
334
330
335
331
Use [Set-AzNetworkInterface](/powershell/module/az.network/set-aznetworkinterface) to change the DNS server setting from inherited to a custom setting. Replace the DNS server IP addresses with your custom IP addresses.
336
332
@@ -379,13 +375,13 @@ IP forwarding is typically used with user-defined routes. For more information,
379
375
380
376
While IP forwarding is an Azure setting, the VM must also run an application that's able to forward the traffic, such as a firewall, WAN optimization, or load balancing application. A VM that runs network applications is often called a network virtual appliance (NVA). You can view a list of ready-to-deploy NVAs in the [Azure Marketplace](https://azuremarketplace.microsoft.com/marketplace/apps?search=network%20virtual%20appliances).
381
377
382
-
# [Portal](#tab/network-interface-portal)
378
+
# [Portal](#tab/azure-portal)
383
379
384
380
1. On the NIC's page, select **IP configurations** in the left navigation.
385
381
1. On the **IP configurations** page, under **IP forwarding settings**, select **Enabled** or **Disabled**, the default, to change the setting.
386
382
1. Select **Save**.
387
383
388
-
# [Azure CLI](#tab/network-interface-cli)
384
+
# [Azure CLI](#tab/azure-cli)
389
385
390
386
Use [az network nic update](/cli/azure/network/nic#az-network-nic-update) to enable or disable the IP forwarding setting.
391
387
@@ -407,7 +403,7 @@ az network nic update \
407
403
--ip-forwarding false
408
404
```
409
405
410
-
# [PowerShell](#tab/network-interface-powershell)
406
+
# [PowerShell](#tab/azure-powershell)
411
407
412
408
Use [Set-AzNetworkInterface](/powershell/module/az.network/set-aznetworkinterface) to enable or disable the IP forwarding setting.
413
409
@@ -445,7 +441,7 @@ $nic | Set-AzNetworkInterface
445
441
446
442
You can change the subnet, but not the virtual network, that a NIC is assigned to.
447
443
448
-
# [Portal](#tab/network-interface-portal)
444
+
# [Portal](#tab/azure-portal)
449
445
450
446
1. On the NIC's page, select **IP configurations** in the left navigation.
451
447
1. On the **IP configurations** page, under **IP configurations**, if any private IP addresses listed have **(Static)** next to them, change the IP address assignment method to dynamic. All private IP addresses must be assigned with the dynamic assignment method to change the subnet assignment for the NIC.
@@ -461,7 +457,7 @@ You can change the subnet, but not the virtual network, that a NIC is assigned t
461
457
462
458
After assigning the NIC to a new subnet, you can assign a static IPv4 address from the new subnet address range if you choose. For more information about adding, changing, and removing IP addresses for a NIC, see [Configure IP addresses for an Azure network interface](./ip-services/virtual-network-network-interface-addresses.md).
463
459
464
-
# [Azure CLI](#tab/network-interface-cli)
460
+
# [Azure CLI](#tab/azure-cli)
465
461
466
462
Use [az network nic ip-config update](/cli/azure/network/nic#az-network-nic-ip-config-update) to change the subnet of the NIC.
467
463
@@ -474,7 +470,7 @@ az network nic ip-config update \
474
470
--vnet-name myVNet
475
471
```
476
472
477
-
# [PowerShell](#tab/network-interface-powershell)
473
+
# [PowerShell](#tab/azure-powershell)
478
474
479
475
Use [Set-AzNetworkInterfaceIpConfig](/powershell/module/az.network/set-aznetworkinterfaceipconfig) to change the subnet of the NIC.
480
476
@@ -509,7 +505,7 @@ You can add NICs only to application security groups in the same virtual network
509
505
510
506
You can use the portal to add or remove a NIC for an application security group only if the NIC is attached to a VM. Otherwise, use PowerShell or Azure CLI. For more information, see [Application security groups](./network-security-groups-overview.md#application-security-groups) and [How to create an application security group](manage-network-security-group.md).
511
507
512
-
# [Portal](#tab/network-interface-portal)
508
+
# [Portal](#tab/azure-portal)
513
509
514
510
To add or remove a NIC for an application security group on a VM, follow this procedure:
515
511
@@ -523,7 +519,7 @@ To add or remove a NIC for an application security group on a VM, follow this pr
523
519
1. Select the application security groups you want to add the NIC to, or deselect the application security groups you want to remove the NIC from.
524
520
1. Select **Save**.
525
521
526
-
# [Azure CLI](#tab/network-interface-cli)
522
+
# [Azure CLI](#tab/azure-cli)
527
523
528
524
Use [az network nic ip-config update](/cli/azure/network/nic#az-network-nic-ip-config-update) to set the application security group.
529
525
@@ -535,7 +531,7 @@ az network nic ip-config update \
535
531
--application-security-groups myASG
536
532
```
537
533
538
-
# [PowerShell](#tab/network-interface-powershell)
534
+
# [PowerShell](#tab/azure-powershell)
539
535
540
536
Use [Set-AzNetworkInterfaceIpConfig](/powershell/module/az.network/set-aznetworkinterfaceipconfig) to set the application security group.
### Associate or dissociate a network security group
574
570
575
-
# [Portal](#tab/network-interface-portal)
571
+
# [Portal](#tab/azure-portal)
576
572
577
573
1. On the NIC's page, select **Network security group** in the left navigation.
578
574
1. On the **Network security group** page, select the network security group you want to associate, or select **None** to dissociate the NSG.
579
575
1. Select **Save**.
580
576
581
-
# [Azure CLI](#tab/network-interface-cli)
577
+
# [Azure CLI](#tab/azure-cli)
582
578
583
579
Use [az network nic update](/cli/azure/network/nic#az-network-nic-update) to set the network security group for the NIC.
584
580
@@ -589,7 +585,7 @@ az network nic update \
589
585
--network-security-group myNSG
590
586
```
591
587
592
-
# [PowerShell](#tab/network-interface-powershell)
588
+
# [PowerShell](#tab/azure-powershell)
593
589
594
590
Use [Set-AzNetworkInterface](/powershell/module/az.network/set-aznetworkinterface) to set the network security group for the NIC.
595
591
@@ -615,19 +611,19 @@ You can delete a NIC if it's not attached to a VM. If the NIC is attached to a V
615
611
616
612
To detach the NIC from the VM, complete the steps in [Remove a network interface from a VM](virtual-network-network-interface-vm.md#remove-a-network-interface-from-a-vm). A VM must always have at least one NIC attached to it, so you can't delete the only NIC from a VM.
617
613
618
-
# [Portal](#tab/network-interface-portal)
614
+
# [Portal](#tab/azure-portal)
619
615
620
616
To delete a NIC, on the **Overview** page for the NIC you want to delete, select **Delete** from the top menu bar, and then select **Yes**.
621
617
622
-
# [Azure CLI](#tab/network-interface-cli)
618
+
# [Azure CLI](#tab/azure-cli)
623
619
624
620
Use [az network nic delete](/cli/azure/network/nic#az-network-nic-delete) to delete the NIC.
625
621
626
622
```azurecli-interactive
627
623
az network nic delete --name myNIC --resource-group myResourceGroup
628
624
```
629
625
630
-
# [PowerShell](#tab/network-interface-powershell)
626
+
# [PowerShell](#tab/azure-powershell)
631
627
632
628
Use [Remove-AzNetworkInterface](/powershell/module/az.network/remove-aznetworkinterface) to delete the NIC.
633
629
@@ -645,7 +641,7 @@ If you have communication problems with a VM, network security group rules or ef
645
641
646
642
The effective security rules for each NIC attached to a VM are a combination of the rules you created in an NSG and [default security rules](./network-security-groups-overview.md#default-security-rules). Understanding the effective security rules for a NIC might help you determine why you're unable to communicate to or from a VM. You can view the effective rules for any NIC that's attached to a running VM.
647
643
648
-
# [Portal](#tab/network-interface-portal)
644
+
# [Portal](#tab/azure-portal)
649
645
650
646
1. In the [Azure portal](https://portal.azure.com), search for and select *virtual machines*.
651
647
1. On the **Virtual machines** page, select the VM you want to view settings for.
@@ -654,15 +650,15 @@ The effective security rules for each NIC attached to a VM are a combination of
654
650
1. On the NIC's page, select **Effective security rules** under **Help** in the left navigation.
655
651
1. Review the list of effective security rules to determine if the rules are correct for your required inbound and outbound communications. For more information about security rules, see [Network security group overview](network-security-groups-overview.md).
656
652
657
-
# [Azure CLI](#tab/network-interface-cli)
653
+
# [Azure CLI](#tab/azure-cli)
658
654
659
655
Use [az network nic list-effective-nsg](/cli/azure/network/nic#az-network-nic-list-effective-nsg) to view the list of effective security rules.
660
656
661
657
```azurecli-interactive
662
658
az network nic list-effective-nsg --name myNIC --resource-group myResourceGroup
663
659
```
664
660
665
-
# [PowerShell](#tab/network-interface-powershell)
661
+
# [PowerShell](#tab/azure-powershell)
666
662
667
663
Use [Get-AzEffectiveNetworkSecurityGroup](/powershell/module/az.network/get-azeffectivenetworksecuritygroup) to view the list of effective security rules.
668
664
@@ -682,20 +678,20 @@ The effective routes for the NIC or NICs attached to a VM are a combination of:
682
678
683
679
Understanding the effective routes for a NIC might help you determine why you can't communicate with a VM. You can view the effective routes for any NIC that's attached to a running VM.
684
680
685
-
# [Portal](#tab/network-interface-portal)
681
+
# [Portal](#tab/azure-portal)
686
682
687
683
1. On the page for the NIC that's attached to the VM, select **Effective routes** under **Help** in the left navigation.
688
684
1. Review the list of effective routes to see if the routes are correct for your required inbound and outbound communications. For more information about routing, see [Routing overview](virtual-networks-udr-overview.md).
689
685
690
-
# [Azure CLI](#tab/network-interface-cli)
686
+
# [Azure CLI](#tab/azure-cli)
691
687
692
688
Use [az network nic show-effective-route-table](/cli/azure/network/nic#az-network-nic-show-effective-route-table) to view a list of the effective routes.
693
689
694
690
```azurecli-interactive
695
691
az network nic show-effective-route-table --name myNIC --resource-group myResourceGroup
696
692
```
697
693
698
-
# [PowerShell](#tab/network-interface-powershell)
694
+
# [PowerShell](#tab/azure-powershell)
699
695
700
696
Use [Get-AzEffectiveRouteTable](/powershell/module/az.network/get-azeffectiveroutetable) to view a list of the effective routes.
0 commit comments