Set-​Azure​VNet​Gateway

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

Syntax

Set-AzureVNetGateway
   [-Connect]
   -LocalNetworkSiteName <String>
   [-Profile <AzureSMProfile>]
   -VNetName <String>
   [<CommonParameters>]
Set-AzureVNetGateway
   [-Disconnect]
   -LocalNetworkSiteName <String>
   [-Profile <AzureSMProfile>]
   -VNetName <String>
   [<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.

Required 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
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
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
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
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-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
Accept pipeline input:False
Accept wildcard characters:False