Occasionally I run into a situation where I need to deploy an SSIS Project to a server on a different domain than my local PC is on. A lot of my work is done over VPN, so it’s pretty common for me to have my laptop on one domain and the SQL Server I need to deploy to is on another domain. This can get tricky, as I usually run in to the dreaded “Login is from an untrusted domain” error.
Thankfully, I’ve been able to find a handy little trick that allows me to easily deploy packages across a VPN to a different domain. It is called Runas. Runas is a command-line tool that is built into Windows, and as Microsoft states, it:
allows a user to run specific tools and programs with different permissions than the user’s current logon provides
By specifically using the /netonly and /user parameters of Runas, you can tell Visual Studio to use your Active Directory credentials for the domain you want to deploy to, and that should allow you to deploy successfully. It is actually incredibly simple to use, all you have to do is use Runas to open Visual Studio, and then you will be able to deploy across the VPN as normal.
Now, before I show you the code I use, I want to clarify a couple of things:
- I am testing this using Visual Studio 2015 on Windows 10. I have no idea if this works with other VS/Windows combinations
- You have to have a working AD account with appropriate permissions on the domain you’re trying to deploy to
Below is the command I run to open Visual Studio with Runas. Simply replace YourDomain\YourUser with your Active Directory account for the domain you want to access, and you may need to modify the path to VS if you are using a different version.
runas /netonly /user:YourDomain\YourUser "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"
That’s it. When I run that command, it asks for the password for the AD account I specified, and thens open Visual Studio after I supply the password. Once VS opens, I am then able to go through the deployment wizard as usual. I actually have this saved as a batch file that I can click whenever I’m ready to deploy my SSIS project. That way it’s not even really an extra step, I just click the batch file instead of the Visual Studio icon.