5

While Azure Connect is being retired and Azure Virtual Network provides similar feature with better speed, i've noticed few drawbacks though.

Azure Connect was capable of maintaining connection automatically, without user even having to log in. Azure Virtual Network however requires user to interactively connect/reconnect to VPN. This makes it quite unusable in production environment. Are there any ways to overcome this obstacle?

Kara
  • 6,115
  • 16
  • 50
  • 57
Bas van Rossum
  • 487
  • 5
  • 13

2 Answers2

13

To solve this problem you can use rasdial. First time i used rasdial i run into this problem: This function is not supported on this system. Don't get fooled by this message because its just that you didn't give the correct syntax.

rasdial "Your VPN name" /phonebook:%userprofile%\AppData\Roaming\Microsoft\Network\Connections\Cm\Your-VPN\Your-VPN.pbk"
  • %userprofile% is de user profiel you used to install Azure vpn with.
  • Your-VPN is de name of the azure vpn connection.

A simpel methode is to make a batch script:

SET VPN_NAME=azureVPN
:loop
rasdial %VPN_NAME% /PHONEBOOK:C:\Users\bas\AppData\Roaming\Microsoft\Network\Connections\Cm\%VPN_NAME%\%VPN_NAME%.pbk
timeout 10
goto loop

result will be:

Connecting to test...
Verifying username and password...
Registering your computer on the network...
Successfully connected to test.
Command completed successfully.

after 10 seconds:

You are already connected to test.
Command completed successfully.

To let this script start when the computer starts use the taskscheduler.

Bas van Rossum
  • 487
  • 5
  • 13
  • This solution does indeed work. Just need to make sure you have the client certificate installed in the tfs service account's personal certificate store – jochen.vg Jan 07 '14 at 21:02
  • 1
    I am able to get a connection using this method, but I need to use my "Azure Network Id" which is a long random string of characters instead of the "Virtual Network Name". The connection however isn't correct and does not let me get into the network. When I try and use my "VPN name" it says it can't find the phonebook entry for this connection. Any ideas? – TWilly Jun 11 '14 at 14:44
  • 2
    This article was helpful, but is pretty involved.. http://www.diaryofaninja.com/blog/2013/11/27/deconstructing-the-azure-point-to-site-vpn-for-command-line-usage – TWilly Jun 11 '14 at 14:57
  • The linked method by degree makes a powershell window popup (see [here](http://stackoverflow.com/a/1802836/794638)) every five minutes which is a bit ugly. Also, if the connection fails another window comes up where you can retry or turn on logging. Also very ugly to end-users. – sinned Jan 20 '15 at 10:37
  • This works for me, except that the folder name for me was an ugly hexidecimal thing, rather than the name of the VPN that Windows displays. As Shahin notes in another answer, the VPN name needs to match that ugly thing. – adam.baker Nov 26 '16 at 13:03
3

This works you just need to go to the folder and get the long name for the phone book from that folder. Also the AzureVPN (the name) should be replaced with the same thing without .pbk