az network vnet-gateway

Use an Azure Virtual Network Gateway to establish secure, cross-premises connectivity.

To learn more about Azure Virtual Network Gateways, visit https://docs.microsoft.com/azure/vpn-gateway/vpn-gateway-howto-site-to-site-resource-manager-cli.

Commands

Name Description Type Status
az network vnet-gateway create

Create a virtual network gateway.

Core GA
az network vnet-gateway delete

Delete a virtual network gateway.

Core GA
az network vnet-gateway list

List virtual network gateways.

Core GA
az network vnet-gateway revoked-cert

Manage revoked certificates in a virtual network gateway. Prevent machines using this certificate from accessing Azure through this gateway.

Core GA
az network vnet-gateway revoked-cert create

Revoke a certificate.

Core GA
az network vnet-gateway revoked-cert delete

Delete a revoked certificate.

Core GA
az network vnet-gateway revoked-cert wait

Place the CLI in a waiting state until a condition is met.

Core GA
az network vnet-gateway root-cert

Manage root certificates of a virtual network gateway.

Core GA
az network vnet-gateway root-cert create

Upload a root certificate.

Core GA
az network vnet-gateway root-cert delete

Delete a root certificate.

Core GA
az network vnet-gateway root-cert wait

Place the CLI in a waiting state until a condition is met.

Core GA
az network vnet-gateway show

Get the details of a virtual network gateway.

Core GA
az network vnet-gateway update

Update a virtual network gateway.

Core GA
az network vnet-gateway vpn-client

Download a VPN client configuration required to connect to Azure via point-to-site.

Core GA
az network vnet-gateway vpn-client generate

Generate VPN client configuration.

Core GA
az network vnet-gateway wait

Place the CLI in a waiting state until a condition is met.

Core GA

az network vnet-gateway create

Create a virtual network gateway.

az network vnet-gateway create --name
                               --public-ip-address
                               --resource-group
                               --vnet
                               [--address-prefix]
                               [--asn]
                               [--bgp-peering-address]
                               [--gateway-default-site]
                               [--gateway-type {ExpressRoute, Vpn}]
                               [--location]
                               [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                               [--peer-weight]
                               [--root-cert-data]
                               [--root-cert-name]
                               [--sku {Basic, HighPerformance, Standard}]
                               [--tags]
                               [--vpn-type {PolicyBased, RouteBased}]

Examples

Create a basic virtual network gateway for site-to-site connectivity.

az network vnet-gateway create -g MyResourceGroup -n MyVnetGateway --public-ip-address MyGatewayIp --vnet MyVnet --gateway-type Vpn --sku VpnGw1 --vpn-type RouteBased --no-wait

Create a virtual network gateway.

az network vnet-gateway create --gateway-type Vpn --location westus2 --name MyVnetGateway --no-wait --public-ip-addresses myVGPublicIPAddress --resource-group MyResourceGroup --sku Basic --vnet MyVnet --vpn-type PolicyBased

Required Parameters

--name -n

Name of the VNet gateway.

--public-ip-address --public-ip-addresses

Specify a single public IP (name or ID) for an active-standby gateway. Specify two space-separated public IPs for an active-active gateway. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--vnet

Name or ID of an existing virtual network which has a subnet named 'GatewaySubnet'.

Optional Parameters

--address-prefix --address-prefixes

Space-separated list of CIDR prefixes representing the address space for the P2S Vpnclient. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more. Singular flags: --address-prefix.

--asn

Autonomous System Number to use for the BGP settings.

--bgp-peering-address

IP address to use for BGP peering.

--gateway-default-site

Name or ID of a local network gateway representing a local network site with default routes.

--gateway-type

The gateway type.

accepted values: ExpressRoute, Vpn
default value: Vpn
--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--no-wait

Do not wait for the long-running operation to finish.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--peer-weight

Weight (0-100) added to routes learned through BGP peering.

--root-cert-data

Base64 contents of the root certificate file or file path.

--root-cert-name

Root certificate name.

--sku

VNet gateway SKU.

accepted values: Basic, HighPerformance, Standard
default value: Basic
--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--vpn-type

VPN routing type.

accepted values: PolicyBased, RouteBased
default value: RouteBased
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network vnet-gateway delete

Delete a virtual network gateway.

In order to delete a Virtual Network Gateway, you must first delete ALL Connection objects in Azure that are connected to the Gateway. After deleting the Gateway, proceed to delete other resources now not in use. For more information, follow the order of instructions on this page: https://docs.microsoft.com/azure/vpn-gateway/vpn-gateway-delete-vnet-gateway-portal.

az network vnet-gateway delete [--ids]
                               [--name]
                               [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                               [--resource-group]
                               [--subscription]

Examples

Delete a virtual network gateway.

az network vnet-gateway delete -g MyResourceGroup -n MyVnetGateway

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the VNet gateway.

--no-wait

Do not wait for the long-running operation to finish.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network vnet-gateway list

List virtual network gateways.

az network vnet-gateway list --resource-group

Examples

List virtual network gateways in a resource group.

az network vnet-gateway list -g MyResourceGroup

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network vnet-gateway show

Get the details of a virtual network gateway.

az network vnet-gateway show [--ids]
                             [--name]
                             [--resource-group]
                             [--subscription]

Examples

Get the details of a virtual network gateway.

az network vnet-gateway show -g MyResourceGroup -n MyVnetGateway

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the VNet gateway.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network vnet-gateway update

Update a virtual network gateway.

az network vnet-gateway update [--add]
                               [--address-prefix]
                               [--asn]
                               [--bgp-peering-address]
                               [--enable-bgp {0, 1, f, false, n, no, t, true, y, yes}]
                               [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                               [--gateway-default-site]
                               [--gateway-type {ExpressRoute, Vpn}]
                               [--ids]
                               [--name]
                               [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                               [--peer-weight]
                               [--public-ip-address]
                               [--remove]
                               [--resource-group]
                               [--root-cert-data]
                               [--root-cert-name]
                               [--set]
                               [--sku {Basic, HighPerformance, Standard}]
                               [--subscription]
                               [--tags]
                               [--vnet]
                               [--vpn-type {PolicyBased, RouteBased}]

Examples

Change the SKU of a virtual network gateway.

az network vnet-gateway update -g MyResourceGroup -n MyVnetGateway --sku VpnGw2

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--address-prefix --address-prefixes

Space-separated list of CIDR prefixes representing the address space for the P2S Vpnclient. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more. Singular flags: --address-prefix.

--asn

Autonomous System Number to use for the BGP settings.

--bgp-peering-address

IP address to use for BGP peering.

--enable-bgp

Enable BGP (Border Gateway Protocol).

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--gateway-default-site

Name or ID of a local network gateway representing a local network site with default routes.

--gateway-type

The gateway type.

accepted values: ExpressRoute, Vpn
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the VNet gateway.

--no-wait

Do not wait for the long-running operation to finish.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--peer-weight

Weight (0-100) added to routes learned through BGP peering.

--public-ip-address --public-ip-addresses

Specify a single public IP (name or ID) for an active-standby gateway. Specify two space-separated public IPs for an active-active gateway. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--root-cert-data

Base64 contents of the root certificate file or file path.

--root-cert-name

Root certificate name.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--sku

VNet gateway SKU.

accepted values: Basic, HighPerformance, Standard
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--vnet

Name or ID of an existing virtual network which has a subnet named 'GatewaySubnet'.

--vpn-type

VPN routing type.

accepted values: PolicyBased, RouteBased
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network vnet-gateway wait

Place the CLI in a waiting state until a condition is met.

az network vnet-gateway wait [--created]
                             [--custom]
                             [--deleted]
                             [--exists]
                             [--ids]
                             [--interval]
                             [--name]
                             [--resource-group]
                             [--subscription]
                             [--timeout]
                             [--updated]

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

default value: False
--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--deleted

Wait until deleted.

default value: False
--exists

Wait until the resource exists.

default value: False
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--interval

Polling interval in seconds.

default value: 30
--name -n

Name of the VNet gateway.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--timeout

Maximum wait in seconds.

default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.

default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.