This article guides you through the process of creating a new Azure SQL Database using various methods, including the Azure portal, Azure CLI, and PowerShell.
Azure SQL Database is a fully managed platform as a service (PaaS) database engine that handles most of the database management functions such as upgrading, patching, backups, and monitoring without user involvement. You can create an Azure SQL Database as part of an Azure SQL server or within an Azure SQL Managed Instance.
You can create an Azure SQL Database using one of the following methods:
The Azure portal provides a user-friendly graphical interface for creating and managing Azure resources.
Sign in to the Azure portal.
In the Azure portal, search for and select SQL databases.
On the SQL databases page, select + Create.
On the Basics tab, fill out the following details:
Click Review + create to validate your settings, then click Create to deploy the database.
The Azure Command-Line Interface (CLI) is a powerful tool for managing Azure resources from your terminal.
Ensure you have the Azure CLI installed and are logged in to your Azure account (`az login`).
$ az sql db create \
--resource-group myResourceGroup \
--server myserver \
--name mydatabase \
--edition Basic \
--family Gen5 \
--capacity 2
az sql server create command first.
$ az sql server create \
--name myserver \
--resource-group myResourceGroup \
--location eastus \
--admin-user azureuser \
--admin-password P@ssw0rd123
Azure PowerShell provides cmdlets to manage Azure resources.
Ensure you have the Azure PowerShell module installed and are connected to your Azure account (`Connect-AzAccount`).
PS C:\> New-AzSqlDatabase `
-ResourceGroupName myResourceGroup `
-ServerName myserver `
-DatabaseName mydatabase `
-Edition Standard `
-RequestedServiceObjectiveName S0
Edition and RequestedServiceObjectiveName (or other performance settings like MaxSizeBytes) when creating a database.
Once your Azure SQL Database is created, you can: