Уреди

Делите путем


Verify a connection for VPN Gateway

This article shows you how to verify a VPN gateway connection for both the classic and the Resource Manager deployment model.

Azure portal

In the Azure portal, you can view the connection status of a VPN gateway by going to the connection. The following steps show one way to navigate to your connection and verify.

  1. In the Azure portal, go to your virtual network gateway.
  2. On the page for your virtual network gateway, click Connections. You can see the status of each connection.
  3. Click the name of the connection that you want to verify. In Essentials, you can view more information about your connection. The Status values are 'Succeeded' and 'Connected' when you have made a successful connection.

PowerShell

You can verify that your connection succeeded by using the 'Get-AzVirtualNetworkGatewayConnection' cmdlet, with or without '-Debug'.

  1. Use the following cmdlet example, configuring the values to match your own. If prompted, select 'A' in order to run 'All'. In the example, '-Name' refers to the name of the connection that you want to test.

    Get-AzVirtualNetworkGatewayConnection -Name VNet1toSite1 -ResourceGroupName TestRG1
    
  2. After the cmdlet has finished, view the values. In the example below, the connection status shows as 'Connected' and you can see ingress and egress bytes.

    "connectionStatus": "Connected",
    "ingressBytesTransferred": 33509044,
    "egressBytesTransferred": 4142431
    

Azure CLI

You can verify that your connection succeeded by using the az network vpn-connection show command. In the example, '--name' refers to the name of the connection that you want to test. When the connection is in the process of being established, its connection status shows 'Connecting'. Once the connection is established, the status changes to 'Connected'. Modify the following example with the values for your environment.

az network vpn-connection show --name <connection-name> --resource-group <resource-group-name>

Azure portal (classic)

In the Azure portal, you can view the connection status for a classic VNet VPN Gateway by navigating to the connection. The following steps show one way to navigate to your connection and verify.

  1. In the Azure portal, go to your classic virtual network (VNet).
  2. On the virtual network page, click the type of connection you want to view. For example, Site-to-site connections.
  3. On the Site-to-site connections page, under Name, select the site connection you want to view.
  4. On the Properties page, view the information about the connection.

PowerShell (classic)

To verify your VPN gateway connection for the classic deployment model using PowerShell, install the latest versions of the Azure PowerShell cmdlets. Be sure to download and install the Service Management module. Use 'Add-AzureAccount' to log in to the classic deployment model.

You can verify that your connection succeeded by using the 'Get-AzureVNetConnection' cmdlet.

  1. Use the following cmdlet example, configuring the values to match your own. The name of the virtual network must be in quotes if it contains spaces.

    Get-AzureVNetConnection "Group ClassicRG TestVNet1"
    
  2. After the cmdlet has finished, view the values. In the example below, the Connectivity State shows as 'Connected' and you can see ingress and egress bytes.

    ConnectivityState         : Connected
    EgressBytesTransferred    : 181664
    IngressBytesTransferred   : 182080
    LastConnectionEstablished : 10/19/22020 12:40:54 AM
    LastEventID               : 24401
    LastEventMessage          : The connectivity state for the local network site 'F7F7BFC7_SiteVNet4' changed from Connecting to
                                Connected.
    LastEventTimeStamp        : 10/19/2020 12:40:54 AM
    LocalNetworkSiteName      : F7F7BFC7_SiteVNet4
    

Next steps