Azure: Virtual Network Gateway Diagnostics (VPN)

This script sample demonstrates how the Azure Virtual Networks PowerShell cmdlets can be utilized to gather Azure Gateway Diagnostics data. This logging is useful for troubleshooting VPN connection issues, and includes messages such as MainMode SA (Phase 1) and QuickMode SA (Phas

4.4 Star
8,722 times
Add to favorites
Windows Azure
E-mail Twitter Digg Facebook
  • Capturing VNG VPN Diagbstics in ARM Subscription
    1 Posts | Last post March 22, 2017
    • Do we have PS scripts or procedure to capture VPN VIrtual Network Gateway if the subscriptions is running on RM?
  • BGP Diagnostics?
    1 Posts | Last post January 30, 2017
    • Does this diagnostics script capture any BGP information?  We are running it, but do not see anything about the BGP sessions connecting, or what is happening inside the BGP protocol at the gateway.
  • Is there a RM version
    3 Posts | Last post November 15, 2016
    • I'd also like to know if there's a RM version of the Start-AzureVNetGatewayDiagnostics function?
    • You may have found this already, but after searching for the same thing, I did find another article posted by Keith Mayer for troubleshooting ARM Gateways:
    • It seems to have moved since JustaDaKaje found it. It is now at
  • Trace collection beyond five minutes
    2 Posts | Last post May 18, 2016
    • Is there a way to collect the VPN trace beyond five minutes
    • When you look at the help article for that cmdlet, the -CaptureDurationInSeconds Parameter explicitly states "The duration of the capture in seconds (between 1 and 300)". So, the only way you could capture beyond five minutes is run a capture script with a built-in wait or pause and then run it again or just setup a for loop with the diagnostics cmdlet running in the body of the loop.
  • Is there a version of this that works with Azure Resource Manager?
    1 Posts | Last post October 23, 2015
    • What tools are available to diagnose VPN Gateway problems for Vnets/Gateways/VPNs created with Azure Resource Manager?
  • FAILED: Azure PowerShell update required
    1 Posts | Last post May 27, 2015
    • When using the leatest Windows Azure PowerShell module with the script may fails to run. I did comment out the line no 60 to make it run again.
      56 #check module version
      57 $modver = (Get-Module azure).version
      58 $PSMinor =$modver.Minor
      59 $PSBuild =$modver.Build
      60 #If ($PSMinor -ne 9 -or $PSBuild -lt 11){ Write-Host "`n FAILED: Azure PowerShell update required`n`t`n" -fore red;Exit } Else { Write-Host "`tConfirmed" -fore Green }
  • Small script modification
    1 Posts | Last post August 21, 2014
    • Hello,
      I used your script in order to understand a problem we have with the Site-to-site Multi VPN in Azure...
      Of course I get an unknown strange error message in IKEV2 phase2. But this is better than nothing. 
      It may help the Microsoft support to solve the problem.
      Any way I'de like to thank you for this script :)
      And add a small correction :
      I think there is something missing on the 'test gateway function'
      You don't call the REST API with the certificate and if I execute it I get a certificate missing error.
      In order to correct this I added this :
      "Starting gateway test for $Global:LocalNetworkSiteName to $Global:LocalIP..." | %{ $tbxOutput.AppendText("$_`n") 
      ##### ADDED #######
      $mgmtCertThumb = (Get-AzureSubscription -SubscriptionName $subscriptionName).Certificate