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
title: 'Create a NAT gateway - Resource Manager Template'
3
-
titleSuffix: Azure Virtual Network NAT
3
+
titleSuffix: Azure NAT Gateway
4
4
description: This quickstart shows how to create a NAT gateway by using the Azure Resource Manager template (ARM template).
5
-
services: load-balancer
6
5
author: asudbring
7
-
manager: KumudD
8
6
ms.service: virtual-network
9
7
ms.topic: how-to
10
-
ms.workload: infrastructure-services
11
-
ms.date: 10/27/2020
8
+
ms.date: 04/24/2023
12
9
ms.author: allensu
13
10
ms.custom: subject-armqs, devx-track-arm-template
14
11
# Customer intent: I want to create a NAT gateway by using an Azure Resource Manager template so that I can provide outbound connectivity for my virtual machines.
@@ -26,16 +23,41 @@ If your environment meets the prerequisites and you're familiar with using ARM t
26
23
27
24
## Prerequisites
28
25
29
-
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
26
+
# [**Portal**](#tab/create-nat-portal)
30
27
28
+
- If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
29
+
30
+
# [**PowerShell**](#tab/create-nat-powershell)
31
+
32
+
- If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
33
+
34
+
- Azure PowerShell installed locally or Azure Cloud Shell.
35
+
36
+
- Sign in to Azure PowerShell and ensure you've selected the subscription with which you want to use this feature. For more information, see [Sign in with Azure PowerShell](/powershell/azure/authenticate-azureps).
37
+
38
+
- Ensure your `Az.Network` module is 4.3.0 or later. To verify the installed module, use the command `Get-InstalledModule -Name "Az.Network"`. If the module requires an update, use the command `Update-Module -Name Az.Network` if necessary.
39
+
40
+
If you choose to install and use PowerShell locally, this article requires the Azure PowerShell module version 5.4.1 or later. Run `Get-Module -ListAvailable Az` to find the installed version. If you need to upgrade, see [Install Azure PowerShell module](/powershell/azure/install-Az-ps). If you're running PowerShell locally, you also need to run `Connect-AzAccount` to create a connection with Azure.
41
+
42
+
# [**Azure CLI**](#tab/create-nat-cli)
43
+
44
+
- If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
- This how-to article requires version 2.31.0 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
49
+
50
+
---
31
51
## Review the template
32
52
33
53
The template used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/nat-gateway-1-vm).
34
54
35
55
This template is configured to create a:
36
56
37
57
* Virtual network
58
+
38
59
* NAT gateway resource
60
+
39
61
* Ubuntu virtual machine
40
62
41
63
The Ubuntu VM is deployed to a subnet that's associated with the NAT gateway resource.
@@ -45,34 +67,42 @@ The Ubuntu VM is deployed to a subnet that's associated with the NAT gateway res
45
67
Nine Azure resources are defined in the template:
46
68
47
69
***[Microsoft.Network/networkSecurityGroups](/azure/templates/microsoft.network/networksecuritygroups)**: Creates a network security group.
70
+
48
71
***[Microsoft.Network/networkSecurityGroups/securityRules](/azure/templates/microsoft.network/networksecuritygroups/securityrules)**: Creates a security rule.
72
+
49
73
***[Microsoft.Network/publicIPAddresses](/azure/templates/microsoft.network/publicipaddresses)**: Creates a public IP address.
74
+
50
75
***[Microsoft.Network/publicIPPrefixes](/azure/templates/microsoft.network/publicipprefixes)**: Creates a public IP prefix.
76
+
51
77
***[Microsoft.Compute/virtualMachines](/azure/templates/Microsoft.Compute/virtualMachines)**: Creates a virtual machine.
78
+
52
79
***[Microsoft.Network/virtualNetworks](/azure/templates/microsoft.network/virtualnetworks)**: Creates a virtual network.
80
+
53
81
***[Microsoft.Network/natGateways](/azure/templates/microsoft.network/natgateways)**: Creates a NAT gateway resource.
82
+
54
83
***[Microsoft.Network/virtualNetworks/subnets](/azure/templates/microsoft.network/virtualnetworks/subnets)**: Creates a virtual network subnet.
84
+
55
85
***[Microsoft.Network/networkinterfaces](/azure/templates/microsoft.network/networkinterfaces)**: Creates a network interface.
56
86
57
87
## Deploy the template
58
88
59
-
**Azure CLI**
89
+
# [**Portal**](#tab/create-nat-portal)
60
90
61
-
```azurecli-interactive
62
-
read -p "Enter the location (i.e. westcentralus): " location
[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.network%2Fnat-gateway-1-vm%2Fazuredeploy.json)
65
92
66
-
az group create \
67
-
--name $resourceGroupName \
68
-
--location $location
93
+
## Review deployed resources
69
94
70
-
az deployment group create \
71
-
--resource-group $resourceGroupName \
72
-
--template-uri $templateUri
73
-
```
95
+
1. Sign in to the [Azure portal](https://portal.azure.com).
96
+
97
+
1. Select **Resource groups** from the left pane.
98
+
99
+
1. Select the resource group that you created in the previous section. The default resource group name is **myResourceGroupNAT**
100
+
101
+
1. Verify the following resources were created in the resource group:
[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.network%2Fnat-gateway-1-vm%2Fazuredeploy.json)
90
-
91
-
## Review deployed resources
117
+
# [**Azure CLI**](#tab/create-nat-cli)
92
118
93
-
1. Sign in to the [Azure portal](https://portal.azure.com).
94
-
95
-
1. Select **Resource groups** from the left pane.
119
+
```azurecli-interactive
120
+
read -p "Enter the location (i.e. westcentralus): " location
When no longer needed, you can use the [az group delete](/cli/azure/group#az-group-delete) command to remove the resource group and all resources contained within.
137
+
# [**Portal**](#tab/create-nat-portal)
108
138
109
-
```azurecli-interactive
110
-
az group delete \
111
-
--name myResourceGroupNAT
112
-
```
139
+
When no longer needed, delete the resource group, NAT gateway, and all related resources. Select the resource group **myResourceGroupNAT** that contains the NAT gateway, and then select **Delete**.
113
140
114
-
**Azure PowerShell**
141
+
# [**PowerShell**](#tab/create-nat-powershell)
115
142
116
143
When no longer needed, you can use the [Remove-AzResourceGroup](/powershell/module/az.resources/remove-azresourcegroup) command to remove the resource group and all resources contained within.
117
144
118
145
```azurepowershell-interactive
119
146
Remove-AzResourceGroup -Name myResourceGroupNAT
120
147
```
121
148
122
-
**Azure portal**
149
+
# [**Azure CLI**](#tab/create-nat-cli)
123
150
124
-
When no longer needed, delete the resource group, NAT gateway, and all related resources. Select the resource group **myResourceGroupNAT** that contains the NAT gateway, and then select **Delete**.
151
+
When no longer needed, you can use the [az group delete](/cli/azure/group#az-group-delete) command to remove the resource group and all resources contained within.
152
+
153
+
```azurecli-interactive
154
+
az group delete \
155
+
--name myResourceGroupNAT
156
+
```
157
+
158
+
---
125
159
126
160
## Next steps
127
161
128
162
In this quickstart, you created a:
129
163
130
164
* NAT gateway resource
165
+
131
166
* Virtual network
167
+
132
168
* Ubuntu virtual machine
133
169
134
170
The virtual machine is deployed to a virtual network subnet associated with the NAT gateway.
135
171
136
172
To learn more about Virtual Network NAT and Azure Resource Manager, continue to the articles below.
137
173
138
174
* Read an [Overview of Virtual Network NAT](nat-overview.md)
175
+
139
176
* Read about the [NAT Gateway resource](nat-gateway-resource.md)
177
+
140
178
* Learn more about [Azure Resource Manager](../../azure-resource-manager/management/overview.md)
0 commit comments