01 Run account list command (Windows/macOS/Linux) with custom output filters to list the IDs of the cloud subscriptions available in your Azure cloud account:
az account list
--query '[*].id'
02 The command output should return the requested subscription identifiers (IDs):
[
"abcdabcd-1234-abcd-1234-abcdabcdabcd",
"abcd1234-abcd-1234-abcd-abcd1234abcd"
]
03 Run account set command (Windows/macOS/Linux) with the ID of the Azure cloud subscription that you want to examine as the identifier parameter to set the selected subscription to be the current active subscription (the command does not produce an output):
az account set
--subscription abcdabcd-1234-abcd-1234-abcdabcdabcd
04 Run network public-ip create command (Windows/macOS/Linux) to create a new public IP address resource for your Azure NAT gateway:
az network public-ip create
--name cc-project5-nat-pip
--resource-group cloud-shell-storage-westeurope
--allocation-method Static
--sku Standard
05 The command output should return the information available for the new public IP address:
{
"publicIp": {
"ddosSettings": {
"protectionMode": "VirtualNetworkInherited"
},
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/publicIPAddresses/cc-project5-nat-pip",
"idleTimeoutInMinutes": 4,
"ipAddress": "xxx.xxx.xxx.xxx",
"ipTags": [],
"location": "westeurope",
"name": "cc-project5-nat-pip",
"provisioningState": "Succeeded",
"publicIPAddressVersion": "IPv4",
"publicIPAllocationMethod": "Static",
"resourceGroup": "cloud-shell-storage-westeurope",
"sku": {
"name": "Standard",
"tier": "Regional"
},
"type": "Microsoft.Network/publicIPAddresses"
}
}
06 Run network public-ip prefix create command (Windows/macOS/Linux) to create a new public IP prefix resource for your Azure NAT gateway:
az network public-ip prefix create
--name cc-project5-nat-ip-prefix
--resource-group cloud-shell-storage-westeurope
--location westeurope
--length 28
07 The command output should return the information available for the new public IP prefix:
{
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/publicIPPrefixes/cc-project5-nat-ip-prefix",
"ipPrefix": "xxx.xxx.xxx.xxx/28",
"ipTags": [],
"location": "westeurope",
"name": "cc-project5-nat-ip-prefix",
"prefixLength": 28,
"provisioningState": "Succeeded",
"publicIPAddressVersion": "IPv4",
"resourceGroup": "cloud-shell-storage-westeurope",
"sku": {
"name": "Standard",
"tier": "Regional"
},
"type": "Microsoft.Network/publicIPPrefixes"
}
08 Run network nat gateway update command (Windows/macOS/Linux) to assign the new public IP address/public IP prefix to the selected Azure NAT gateway. As an example, the following command is using the --public-ip-addresses parameter to assign a public IP address to the specified NAT gateway. You can use the --public-ip-prefixes parameter to assign an IP prefix instead of an IP address:
az network nat gateway update
--name cc-project5-managed-gateway
--resource-group cloud-shell-storage-westeurope
--public-ip-addresses "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/publicIPAddresses/cc-project5-nat-pip"
09 The command output should return the information available for the configured NAT gateway:
{
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/natGateways/cc-project5-managed-gateway",
"idleTimeoutInMinutes": 4,
"location": "westeurope",
"name": "cc-project5-managed-gateway",
"provisioningState": "Succeeded",
"publicIpAddresses": [
{
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/publicIPAddresses/cc-project5-nat-pip",
"resourceGroup": "cloud-shell-storage-westeurope"
}
],
"resourceGroup": "cloud-shell-storage-westeurope",
"sku": {
"name": "Standard"
},
"tags": {},
"type": "Microsoft.Network/natGateways"
}
10 Repeat steps no. 4 - 9 for each Azure NAT gateway that you want to configure, deployed in the selected Azure subscription.
11 Repeat steps no. 3 – 10 for each subscription created within your Microsoft Azure cloud account.