If you’re working with SQL Server in a corporate environment, you may need to connect to the server using a different Domain User account. For example, you may need to test the access and permissions of newly created SQL Server AD Users. Connecting to SQL Server with a different Domain User can be tricky, but this guide will show you how to do it easily.
Connect to SQL Server with Another AD User
1. Find the SQL Server Management Studio (SSMS) application icon by searching for it using the Windows button, then:
> Right-click the SSMS app icon
> Hold down the CTRL key
> Select “Run As Different User.“
2. Enter the credentials for the desired Domain User in the prompt
This will open SSMS using the login you entered above. Even though the connection window will show an incorrect Domain, SSMS will connect with the desired AD User account.
Open SSMS as Another User with Command
Another way of opening SSMS as a different Domain User is to run the command below in your Windows Terminal. You should amend the Domain and Username before running this.
C:\Windows\System32\runas.exe /user:domain\username /netonly "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe"
The above command can be saved to a shortcut file and will work for you if you are running the latest version of SSMS. As of January 2023, this should be the correct directory for the SSMS executable (SSMS v18).
Hope this guide has got you up and running today!