Quickstart: Create a Synapse SQL pool with Azure CLI

Create a Synapse SQL pool (data warehouse) in Azure Synapse Analytics using the Azure CLI.

Prerequisites

  • Use the Bash environment in Azure Cloud Shell.

    Launch Cloud Shell in a new window

  • If you prefer, install the Azure CLI to run CLI reference commands.

    • If you're using a local installation, sign in to the Azure CLI by using the az login command. To finish the authentication process, follow the steps displayed in your terminal. For additional sign-in options, see Sign in with the Azure CLI.

    • When you're prompted, install Azure CLI extensions on first use. For more information about extensions, see Use extensions with the Azure CLI.

    • Run az version to find the version and dependent libraries that are installed. To upgrade to the latest version, run az upgrade.

Getting started

Use these commands to sign on to Azure and set up a resource group.

  1. If you are using a local install, run the az login command to sign into Azure:

    az login
    
  2. If needed, use the az account set command to select your subscription:

    az account set --subscription 00000000-0000-0000-0000-000000000000
    
  3. Run the az group create command to create a resource group:

    az group create --name myResourceGroup --location WestEurope
    
  4. Create a logical SQL server by using the az sql server create command:

    az sql server create --resource-group myResourceGroup --name mysqlserver \
       --admin-user ServerAdmin --admin-password ChangeYourAdminPassword1
    

    A server contains a group of databases managed as a group.

Configure a server-level firewall rule

Create a server-level firewall rule. A server-level firewall rule allows an external application, such as SQL Server Management Studio or the SQLCMD utility, to connect to a SQL pool through the SQL pool service firewall.

Run the az sql server firewall-rule create command to create a firewall rule:

az sql server firewall-rule create --resource-group myResourceGroup --name AllowSome \
   --server mysqlserver --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0

In this example, the firewall is only opened for other Azure resources. To enable external connectivity, change the IP address to an appropriate address for your environment. To open all IP addresses, use 0.0.0.0 as the starting IP address and 255.255.255.255 as the ending address.

Note

SQL endpoints communicate over port 1433. If you're trying to connect from within a corporate network, outbound traffic over port 1433 may not be allowed by your network's firewall. If so, you won't be able to connect to your server unless your IT department opens port 1433.

Create and manage your SQL pool

Create the SQL pool. This example uses DW100c as the service objective, which is a lower-cost starting point for your SQL pool.

Note

You need a previously created workspace. For more information, see Quickstart: Create an Azure synapse workspace with Azure CLI.

Use the az synapse sql pool create command to create the SQL pool:

az synapse sql pool create --resource-group myResourceGroup --name mySampleDataWarehouse \
   --performance-level "DW1000c" --workspace-name testsynapseworkspace

For more information on the parameter options, see az synapse sql pool.

You can see your SQL pools by using the az synapse sql pool list command:

az synapse sql pool list --resource-group myResourceGroup --workspace-name testsynapseworkspace

Use the az synapse sql pool update command to update an existing pool:

az synapse sql pool update --resource-group myResourceGroup --name mySampleDataWarehouse \
   --workspace-name testsynapseworkspace

Use the az synapse sql pool pause command to pause your pool:

az synapse sql pool pause --resource-group myResourceGroup --name mySampleDataWarehouse \
   --workspace-name testsynapseworkspace

Use the az synapse sql pool resume command to start a paused pool:

az synapse sql pool resume --resource-group myResourceGroup --name mySampleDataWarehouse \
   --workspace-name testsynapseworkspace

To remove an existing SQL pool, use the az synapse sql pool delete command:

az synapse sql pool delete --resource-group myResourceGroup --name mySampleDataWarehouse \
   --workspace-name testsynapseworkspace

Clean up resources

Other quickstart tutorials in this collection build upon this quickstart.

Tip

If you plan to continue on to work with later quickstart tutorials, don't clean up the resources created in this quickstart. If you don't plan to continue, use the az group delete command to delete all resources created by this quickstart.

az group delete --ResourceGroupName MyResourceGroup

Next steps

You've now created a SQL pool, created a firewall rule, and connected to your SQL pool. To learn more, continue to the Load data into SQL pool article.