Skip to content

Access SQL Server

Required roles

To follow the steps in this guide, you need the following roles:

Prerequisites

To follow the steps in this guide, make sure that you meet the following prerequisites:

You can use IAP Desktop to access SQL Server in two ways:

  1. You can let IAP Desktop launch and connect SQL Server Management Studio (SSMS) for you. IAP Desktop automatically establishes an IAP TCP forwarding tunnel and keeps the tunnel open until you close SSMS.

  2. You can let IAP Desktop open a tunnel. You can then use any tool to connect to that tunnel and the tunnel remains open until you close IAP Desktop.

The way IAP Desktop uses IAP-TCP to connect to SQL Server differs depending on whether you're running SQL Server on Compute Engine or using Cloud SQL for SQL Server:

If you're running SQL Server on Compute Engine, you don't need any additional VM to let IAP Desktop connect to SQL Server. The only prerequisite is a firewall rule that allows IAP-TCP to connect to port 1433 of your SQL Server VM.

Connect to SQL Server

If you're using Cloud SQL for SQL Server, you need an additional VM that runs the Cloud SQL Auth Proxy . This VM is necessary because IAP-TCP doesn't support creating tunnels to managed services such as Cloud SQL.

Connect to SQL Server

To deploy a Cloud SQL Auth Proxy VM, see Set up a Cloud SQL Proxy VM.

Connect SQL Server Management Studio

The steps to let IAP Desktop launch and connect SQL Server Management Studio (SSMS) differ depending on how you want to authenticate to SQL Server:

To access SQL Server and authenticate using Windows authentication , do the following:

  1. In the Project Explorer tool window, right-click your SQL Server VM and select Connect client application > SQL Server Management Studio:

    Context menu

  2. IAP Desktop now creates an IAP TCP forwarding tunnel and opens SQL Server Management Studio.

    If your connection settings contain Windows credentials, SQL Server Management Studio automatically authenticates you to SQL Server using Windows authentication.

    If you haven't configured Windows credentials yet, you can enter credentials manually:

    SSH Terminal

    Note

    You can use Windows authentication even if your local computer isn't domain-joined, or joined to a different Active Directory domain than the SQL Server VM.

    IAP Desktop now launches SSMS and connects it to the VM:

  3. You can now use SSMS to interact with SQL Server:

    SSMS

To access SQL Server and authenticate using SQL authentication, do the following:

  1. In the Project Explorer tool window, right-click your SQL Server VM and select Connection settings.

  2. In the Connection settings window, set SQL Server > Windows authentication to disabled.

  3. In the Project Explorer tool window, right-click your SQL Server VM and select Connect client application > SQL Server Management Studio:

    Context menu

  4. Enter your SQL Server username and click OK.

    IAP Desktop now launches SSMS. If this is the first time you're connecting to this VM, you might see an error message indicating that the login failed because you haven't provided a password. Dismiss the error message and use the SQL Server login dialog to complete authentication.

Open a tunnel

To let IAP Desktop open a tunnel to SQL Server, do the following:

  1. In the Project Explorer tool window, right-click your SQL Server VM and select Tunnel to > SQL Server.

    Open a tunnel

    A notification appears:

    Baloon notification

  2. Use any tool to connect to the tunnel using the port number indicated in the notification.

    Note

    When you open a tunnel to the same VM again in the future, IAP Desktop will use the same port number unless it's in use by a different application.

To view all active tunnels and their port numbers, select View > Active IAP tunnels in the main menu.

Customize connection settings

To customize the connection settings, you can use the Connection Settings tool window:

  1. In the Project Explorer tool window, right-click the SQL Server VM and select Connection Settings.
  2. In the Connection Settings window, you can save your Windows credentials or switch to SQL Server authentication :

    Connection settings

    If you specify a setting that deviates from the default, it is shown in bold typeface.

Instead of customizing settings for each VM instance individually, you can also specify settings that apply to an entire zone or project.

What's next