Connect to Azure SQL Database using SQL Server Management Studio (SSMS)

Learn how to connect to your Azure SQL database from SQL Server Management Studio.

Introduction

SQL Server Management Studio (SSMS) is a powerful, integrated environment for managing any SQL infrastructure, from SQL Server to Azure SQL Database. This tutorial will guide you through the steps to connect to your Azure SQL Database instance using SSMS.

Prerequisites

Steps to Connect

Step 1: Obtain Connection Information

Before you can connect, you need the following details from your Azure SQL Database server:

  • Server Name: This is typically in the format your_server_name.database.windows.net. You can find this on the Overview page of your Azure SQL Database server in the Azure portal.
  • Database Name: The name of the specific database you want to connect to.
  • Login Name: The SQL authentication login you created when setting up the server, or a user within your database.
  • Password: The password associated with your login name.
Step 2: Launch SQL Server Management Studio (SSMS)

Open SSMS on your local machine.

Step 3: Configure the Connection Dialog

In the "Connect to Server" dialog box that appears:

  • Server type: Select Database Engine.
  • Server name: Enter the full server name of your Azure SQL Database (e.g., your_server_name.database.windows.net).
  • Authentication: Choose one of the following:
    • SQL Server Authentication: Enter your Login name and Password.
    • Azure Active Directory - Password Authentication: Enter your Azure AD username and password.
    • Azure Active Directory - Integrated Authentication: If you're signed into Windows with an Azure AD account that has access.
    • Azure Active Directory - Universal with MFA: For interactive sign-in with Multi-Factor Authentication.
Placeholder for SSMS Connection Dialog Screenshot
Step 4: Connect to the Database

Click the Connect button.

If the connection is successful, you will see your Azure SQL Database server listed in the Object Explorer pane on the left side of SSMS.

You can expand the server node and then the "Databases" folder to see your database(s).

Placeholder for SSMS Object Explorer showing Azure SQL Database
Step 5: Query Your Database

To run queries, right-click on your database in the Object Explorer and select "New Query".

You can then write and execute T-SQL queries against your Azure SQL Database.


-- Example Query
SELECT @@VERSION;
GO

SELECT TOP 10 * FROM sys.tables;
GO
                

Troubleshooting Connection Issues

Next Steps

Now that you can connect to your Azure SQL Database, you can start performing various database operations, such as:

Create an Azure SQL Database Query Data in Azure SQL Database