Set-AzureVNetGateway

Enables or disables a VPN gateway for an Azure virtual network.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Set-AzureVNetGateway
   [-Connect]
   -VNetName <String>
   -LocalNetworkSiteName <String>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]
Set-AzureVNetGateway
   [-Disconnect]
   -VNetName <String>
   -LocalNetworkSiteName <String>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

The Set-AzureVNetGateway cmdlet enables or disables a virtual private network (VPN) gateway for an Azure virtual network. A virtual network gateway is a VPN endpoint for connecting to a virtual network. Specify the Connect or Disconnect parameter to enable or disable the VPN connection between an on-premises local network site and a virtual network.

Examples

Example 1: Enable a virtual network gateway for a virtual network

PS C:\> Set-AzureVNetGateway -Connect -VnetName "ContosoProdNet" -LocalNetworkSiteName "ContosoBranchOffice"

This command enables the virtual network gateway between the Azure virtual network named ContosoProdNet and the VPN device for the local network site named ContosoBranchOffice.

Example 2: Disable a virtual network gateway for a virtual network

PS C:\> Set-AzureVNetGateway -Disconnect -VnetName "ContosoProdNet" -LocalNetworkSiteName "ContosoBranchOffice"

This command disables the virtual network gateway between the Azure virtual network named ContosoProdNet and the VPN device for the local network site named ContosoBranchOffice.

Parameters

-Connect

Indicates that this cmdlet enables the VPN connection between a virtual network and a local network site.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Disconnect

Indicates that this cmdlet disables the VPN connection between a virtual network and a local network site.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-LocalNetworkSiteName

Specifies the name of the on-premises local network site for which this cmdlet enables or disables the VPN connection.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VNetName

Specifies the virtual network for which this cmdlet enables or disables the VPN connection.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False