Edit

Share via


Set-AzVirtualNetworkGatewayDefaultSite

Sets the default site for a virtual network gateway.

Syntax

Default (Default)

Set-AzVirtualNetworkGatewayDefaultSite
    -VirtualNetworkGateway <PSVirtualNetworkGateway>
    -GatewayDefaultSite <PSLocalNetworkGateway>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Set-AzVirtualNetworkGatewayDefaultSite cmdlet assigns a forced tunneling default site to a virtual network gateway. Forced tunneling provides a way for you to redirect Internet-bound traffic from Azure virtual machines to your on-premises network; this enables you to inspect and audit traffic before releasing it. Forced tunneling is carried out by using a virtual private network (VPN) tunnel; this tunnel requires a default site, a local gateway where all the Azure Internet-bound traffic is redirected. Set-AzVirtualNetworkGatewayDefaultSite provides a way to change the default site assigned to a gateway.

Examples

Example 1: Assign a default site to a virtual network gateway

$LocalGateway = Get-AzLocalNetworkGateway -Name "ContosoLocalGateway " -ResourceGroupName "ContosoResourceGroup"
$VirtualGateway = Get-AzVirtualNetworkGateway -Name "ContosoVirtualGateway"
Set-AzVirtualNetworkGatewayDefaultSite -GatewayDefaultSite $LocalGateway -VirtualNetworkGateway $VirtualGateway

This example assigns a default site to a virtual network gateway named ContosoVirtualGateway. The first command creates an object reference to a local gateway named ContosoLocalGateway. This object reference that is stored in the variable named $LocalGateway represents the gateway to be configured as the default site . The second command then creates an object reference to the virtual network gateway and stores the result in the variable named $VirtualGateway. The third command uses the Set-AzVirtualNetworkGatewayDefaultSite cmdlet to assign the default site to ContosoVirtualGateway.

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-GatewayDefaultSite

Specifies an object reference to the local network gateway to be assigned as the default site for the specified virtual network. You can use the Get-AzLocalNetworkGateway cmdlet to create an object reference to a local gateway.

Parameter properties

Type:PSLocalNetworkGateway
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-VirtualNetworkGateway

Specifies an object reference to the virtual network gateway where the default site will be assigned. You can create an object reference to a virtual network gateway by using the Get-AzVirtualNetworkGateway and specifying the name of the gateway. The variable $VirtualGateway can then be used as the parameter value for the VirtualNetworkGateway parameter:

Parameter properties

Type:PSVirtualNetworkGateway
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

PSVirtualNetworkGateway

PSLocalNetworkGateway

Outputs

PSVirtualNetworkGateway