Virtual Network NAT with VM

Azure Public Test Date Azure Public Test Result

Azure US Gov Last Test Date Azure US Gov Last Test Result

Best Practice Check Cred Scan Check

Bicep Version

Deploy To Azure Visualize

This template deploys a NAT gateway and supporting resources.


This template is a resource manager implementation of a quickstart for deploying a NAT gateway. An Ubuntu virtual machine is deployed to the subnet that is associated with the NAT gateway. To learn more about how to deploy the template, see the quickstart article.

For more information on Virtual Network NAT service and NAT gateway see:

Deployed resources

The following resources are deployed as part of the solution.


  • networkingSecurityGroups: Network security group for virtual machine.
    • securityrules: NSG rule to open port 22 to virtual machine.
  • publicIPAddresses: Public IP address for NAT gateway and virtual machine.
  • publicIPPrefixes: Public IP prefix for NAT gateway.
  • natGateways: NAT gateway resource.
  • virtualNetworks: Virtual network for NAT gateway and virtual machine.
    • subnets: Subnet for virtual network for NAT gateway and virtual machine.
  • networkinterfaces: Network interface for virtual machine.


  • virtualMachines: Virtual machine for solution.

Tags: virtual network, vnet, nat, nat gateway, virtual machine, Microsoft.Network/networkSecurityGroups, Microsoft.Network/publicIPAddresses, Microsoft.Network/publicIPPrefixes, Microsoft.Compute/virtualMachines, Microsoft.Network/virtualNetworks, Microsoft.Network/natGateways, Microsoft.Network/virtualNetworks/subnets, Microsoft.Network/networkInterfaces