Skip to content

Latest commit

 

History

History
109 lines (72 loc) · 4.54 KB

single-database-create-bicep-quickstart.md

File metadata and controls

109 lines (72 loc) · 4.54 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic ms.custom
Bicep: Create a single database in Azure SQL Database
Create a single database in Azure SQL Database using Bicep.
dimitri-furman
dfurman
mathoma
05/16/2022
sql-database
deployment-configuration
quickstart
subject-armqs sqldbrb=1, mode-arm, devx-track-bicep

Quickstart: Create a single database in Azure SQL Database using Bicep

[!INCLUDEappliesto-sqldb]

Creating a single database is the quickest and simplest option for creating a database in Azure SQL Database. This quickstart shows you how to create a single database using Bicep.

Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. It provides concise syntax, reliable type safety, and support for code reuse. Bicep offers the best authoring experience for your infrastructure-as-code solutions in Azure.

Prerequisites

If you don't have an Azure subscription, create a free account.

Review the Bicep file

A single database has a defined set of compute, memory, IO, and storage resources using one of two purchasing models. When you create a single database, you also define a server to manage it and place it within Azure resource group in a specified region.

The Bicep file used in this quickstart is from Azure Quickstart Templates.

:::code language="bicep" source="~/../quickstart-templates/quickstarts/microsoft.sql/sql-database/main.bicep":::

The following resources are defined in the Bicep file:

Deploy the Bicep file

  1. Save the Bicep file as main.bicep to your local computer.

  2. Deploy the Bicep file using either Azure CLI or Azure PowerShell.

    az group create --name exampleRG --location eastus
    az deployment group create --resource-group exampleRG --template-file main.bicep --parameters administratorLogin=<admin-login>
    
    New-AzResourceGroup -Name exampleRG -Location eastus
    New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -administratorLogin "<admin-login>"
    

Note

Replace <admin-login> with the administrator username of the SQL logical server. You'll be prompted to enter administratorLoginPassword.

When the deployment finishes, you should see a message indicating the deployment succeeded.

Review deployed resources

Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group.

az resource list --resource-group exampleRG
Get-AzResource -ResourceGroupName exampleRG

Clean up resources

When no longer needed, use the Azure portal, Azure CLI, or Azure PowerShell to delete the resource group and its resources.

az group delete --name exampleRG
Remove-AzResourceGroup -Name exampleRG

Next steps