Quantcast
Channel: Azure Networking (DNS, Traffic Manager, VPN, VNET) forum
Viewing all articles
Browse latest Browse all 6513

Set-up a VPN connection to Windows Azure Virtual network

$
0
0

Hi all,

Is it possible at all to establish a VPN connection to Windows Azure Virtual Network as a part of the build process on Hosted TFS (Visual Studio Online)? I would like to run integration tests that would connect to local instances of worker roles on my Virtual Network. I have already created a gateway for the Virtual Network and I am able to establish VPN connection between the Virtual Network and my local Windows 2012 Server virtual machine. Moreover I have it all scripted in Powershell. The problem is that when I set my script as pre-test script in the build definition, the build fails with following errors:

Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting is overridden by
a policy defined at a more specific scope...

Import-PfxCertificate : Access is denied. 0x80070005 (WIN32: 5 ERROR_ACCESS_DENIED

Here is the script that I am trying to execute:

Set-ExecutionPolicy -Scope CurrentUser Unrestricted
$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath

#import client certificate
$mypwd=ConvertTo-SecureString "*******" -Force -AsPlainText
Import-PfxCertificate -FilePath (Join-Path $dir certificates\MyClientCertificate.pfx) cert:\CurrentUser\My -Password $mypwd
Import-PfxCertificate -FilePath (Join-Path $dir certificates\MyClientCertificate.pfx) cert:\localMachine\my -Password $mypwd

#add trusted root certificate
$cert=New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$certPath = Join-Path $dir "certificates\trusted-root-cert.cer"
$cert.import($certPath)
$store=New-Object System.Security.Cryptography.X509Certificates.X509Store("AuthRoot","LocalMachine")
$store.open("MaxAllowed")
$store.add($cert)
$store.close()

#opening VPN connections goes below



Viewing all articles
Browse latest Browse all 6513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>