Manage resources for a single database in Azure SQL Database

With a single database, you determine the amount of resources that the database requires to handle its workload at the service tier, performance level, and amount of storage it requires.

Manage single database resources using the Azure portal

To set or change the service tier, performance level, or storage amount for a new or existing Azure SQL database using the Azure portal, open the Configure performance window for your database by clicking Pricing tier (scale DTUs) - as shown in the following screenshot.

  • Set or change the service tier by selecting the service tier for your workload.
  • Set or change the performance level (DTUs) within a service tier using the DTU slider.
  • Set or change the storage amount for the performance level using the Storage slider.

Configure service tier and performance level

Important

Review Current limitations of P11 and P15 databases with 4-TB maximum size when selecting a P11 or P15 service tier.

Manage single database resources using PowerShell

To set or change Azure SQL databases service tiers, performance levels, and storage amount using PowerShell, use these PowerShell cmdlets. If you need to install or upgrade PowerShell, see Install Azure PowerShell module.

Cmdlet Description
New-AzureRmSqlDatabase Creates a database
Get-AzureRmSqlDatabase Gets one or more databases
Set-​Azure​Rm​Sql​Database Sets properties for a database, or moves an existing database into an elastic pool. For example, use the MaxSizeBytes property to set the maximum size for a database.

Tip

For a PowerShell example script that monitors the performance metrics of a database, scales it to a higher performance level, and creates an alert rule on one of the performance metrics, see Monitor and scale a single SQL database using PowerShell.

Manage single database resources using the Azure CLI

To set or change Azure SQL databases service tiers, performance levels, and storage amount using the Azure CLI, use these Azure CLI SQL Database commands. Use the Cloud Shell to run the CLI in your browser, or install it on macOS, Linux, or Windows. For creating and managing SQL elastic pools, see Elastic pools.

Cmdlet Description
az sql server firewall-rule create Creates a server firewall rule
az sql server firewall-rule list Lists the firewall rules on a server
az sql server firewall-rule show Shows the detail of a firewall rule
az sql server firewall-rule update Updates a firewall rule
az sql server firewall-rule delete Deletes a firewall rule

Tip

For an Azure CLI example script that scales a single Azure SQL database to a different performance level after querying the size information of the database, see Use CLI to monitor and scale a single SQL database.

Manage single database resources using Transact-SQL

To set or change Azure SQL databases service tiers, performance levels, and storage amount with Transact-SQL, use these T-SQL commands. You can issue these commands using the Azure portal, SQL Server Management Studio, Visual Studio Code, or any other program that can connect to an Azure SQL Database server and pass Transact-SQL commands.

Command Description
CREATE DATABASE (Azure SQL Database) Creates a new database. You must be connected to the master database to create a new database.
ALTER DATABASE (Azure SQL Database) Modifies an Azure SQL database.
sys.database_service_objectives (Azure SQL Database) Returns the edition (service tier), service objective (pricing tier), and elastic pool name, if any, for an Azure SQL database or an Azure SQL Data Warehouse. If logged on to the master database in an Azure SQL Database server, returns information on all databases. For Azure SQL Data Warehouse, you must be connected to the master database.
sys.database_usage (Azure SQL Database) Lists the number, type, and duration of databases on an Azure SQL Database server.

The following example shows the maximum size for a database being changed using the ALTER DATABASE command:

ALTER DATABASE <myDatabaseName> 
  MODIFY (MAXSIZE = 4096 GB);

Manage single database resources using the REST API

To set or change Azure SQL databases service tiers, performance levels, and storage amount use these REST API requests.

Command Description
Databases - Create Or Update Creates a new database or updates an existing database.
Databases - Get Gets a database.
Databases - Get By Elastic Pool Gets a database inside of an elastic pool.
Databases - Get By Recommended Elastic Pool Gets a database inside of a recommented elastic pool.
Databases - List By Elastic Pool Returns a list of databases in an elastic pool.
Databases - List By Recommended Elastic Pool Returns a list of databases inside a recommented elastic pool.
Databases - List By Server Returns a list of databases in a server.
Databases - Update Updates an existing database.

Next steps