Jaa


Set up a local development environment for Azure SQL Database

This article teaches you to set up the local development experience for Azure SQL Database. The local development experience for Azure SQL Database enables developers and database professionals to design, edit, build/validate, publish, and run database schemas for databases in Azure SQL Database using a containerized environment.

Important

Set up a development environment with an Azure SQL Database dev container template. To get started, set up an Azure SQL Database local development environment with an dev container template. Dev container templates are a superior alternative and replacement to the Azure SQL Database emulator for local development.

Prerequisites

Before you configure the local development environment for Azure SQL Database, make sure you meet the following hardware and software requirements:

  • Software requirements:
    • Currently supported on Windows 10 or later release, macOS Mojave or later release, and Linux (preferably Ubuntu 18.04 or later release)
    • Azure Data Studio or Visual Studio Code
  • Minimum hardware requirements:
    • 8-GB RAM
    • 10-GB available disk space

Install Docker Desktop

The local development environment for Azure SQL Database uses the Azure SQL Database emulator, a containerized database with close fidelity to the Azure SQL Database public service. The Azure SQL Database emulator is implemented as a Docker container.

Install Docker Desktop. If you're using Windows, set up Docker Desktop for Windows with WSL 2.

Ensure that Docker Desktop is running before using your local development environment for Azure SQL Database.

Install extension

There are different extensions to install depending on your preferred development tool.

Extension Visual Studio Code Azure Data Studio
The mssql extension for Visual Studio Code Install the mssql extension. Installation isn't necessary. The mssql extension as the functionality is natively available.
SQL Database Projects extension (Preview) Installation isn't necessary. The SQL Database Projects extension is bundled with the mssql extension, and is automatically installed and updated when the mssql extension is installed or updated. Install the SQL Database Projects extension.

If you're using Visual Studio Code, install the mssql extension for Visual Studio Code.

The mssql extension enables you to connect and run queries and test scripts against a database. The database can run in the Azure SQL Database emulator locally, or in the global Azure SQL Database service.

To install the extension:

  1. In Visual Studio Code, select View > Command Palette, or press Ctrl+Shift+P, or press F1 to open the Command Palette.

  2. In the Command Palette, select Extensions: Install Extensions from the dropdown.

  3. In the Extensions pane, type mssql.

  4. Select the SQL Server (mssql) extension, and then select Install.

  5. After the installation completes, select Reload to enable the extension.

  6. There's no need to run the docker container with a SQL image manually, it is deployed and run when you Build and Publish a Project.

Begin using your local development environment

You have now set up your local development environment for Azure SQL Database.

Next step

Learn more about the local development experience for Azure SQL Database: