Microsoft.Sql servers/databases 2022-08-01-preview
- Latest
- 2024-05-01-preview
- 2023-08-01-preview
- 2023-05-01-preview
- 2023-02-01-preview
- 2022-11-01-preview
- 2022-08-01-preview
- 2022-05-01-preview
- 2022-02-01-preview
- 2021-11-01
- 2021-11-01-preview
- 2021-08-01-preview
- 2021-05-01-preview
- 2021-02-01-preview
- 2020-11-01-preview
- 2020-08-01-preview
- 2020-02-02-preview
- 2019-06-01-preview
- 2017-10-01-preview
- 2017-03-01-preview
- 2014-04-01
Bicep resource definition
The servers/databases resource type can be deployed with operations that target:
- Resource groups - See resource group deployment commands
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Sql/servers/databases resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.Sql/servers/databases@2022-08-01-preview' = {
parent: resourceSymbolicName
identity: {
type: 'string'
userAssignedIdentities: {
{customized property}: {}
}
}
location: 'string'
name: 'string'
properties: {
autoPauseDelay: int
availabilityZone: 'string'
catalogCollation: 'string'
collation: 'string'
createMode: 'string'
elasticPoolId: 'string'
encryptionProtector: 'string'
federatedClientId: 'string'
highAvailabilityReplicaCount: int
isLedgerOn: bool
keys: {
{customized property}: {}
}
licenseType: 'string'
longTermRetentionBackupResourceId: 'string'
maintenanceConfigurationId: 'string'
manualCutover: bool
maxSizeBytes: int
minCapacity: int
performCutover: bool
preferredEnclaveType: 'string'
readScale: 'string'
recoverableDatabaseId: 'string'
recoveryServicesRecoveryPointId: 'string'
requestedBackupStorageRedundancy: 'string'
restorableDroppedDatabaseId: 'string'
restorePointInTime: 'string'
sampleName: 'string'
secondaryType: 'string'
sourceDatabaseDeletionDate: 'string'
sourceDatabaseId: 'string'
sourceResourceId: 'string'
zoneRedundant: bool
}
sku: {
capacity: int
family: 'string'
name: 'string'
size: 'string'
tier: 'string'
}
tags: {
{customized property}: 'string'
}
}
Property values
DatabaseIdentity
Name | Description | Value |
---|---|---|
type | The identity type | 'None' 'UserAssigned' |
userAssignedIdentities | The resource ids of the user assigned identities to use | DatabaseIdentityUserAssignedIdentities |
DatabaseIdentityUserAssignedIdentities
Name | Description | Value |
---|
DatabaseKey
Name | Description | Value |
---|
DatabaseProperties
Name | Description | Value |
---|---|---|
autoPauseDelay | Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled | int |
availabilityZone | Specifies the availability zone the database is pinned to. | '1' '2' '3' 'NoPreference' |
catalogCollation | Collation of the metadata catalog. | 'DATABASE_DEFAULT' 'SQL_Latin1_General_CP1_CI_AS' |
collation | The collation of the database. | string |
createMode | Specifies the mode of database creation. Default: regular database creation. Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. |
'Copy' 'Default' 'OnlineSecondary' 'PointInTimeRestore' 'Recovery' 'Restore' 'RestoreExternalBackup' 'RestoreExternalBackupSecondary' 'RestoreLongTermRetentionBackup' 'Secondary' |
elasticPoolId | The resource identifier of the elastic pool containing this database. | string |
encryptionProtector | The azure key vault URI of the database if it's configured with per Database Customer Managed Keys. | string |
federatedClientId | The Client id used for cross tenant per database CMK scenario | string Constraints: Min length = 36 Max length = 36 Pattern = ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$ |
highAvailabilityReplicaCount | The number of secondary replicas associated with the database that are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. | int |
isLedgerOn | Whether or not this database is a ledger database, which means all tables in the database are ledger tables. Note: the value of this property cannot be changed after the database has been created. | bool |
keys | The resource ids of the user assigned identities to use | DatabasePropertiesKeys |
licenseType | The license type to apply for this database. LicenseIncluded if you need a license, or BasePrice if you have a license and are eligible for the Azure Hybrid Benefit. |
'BasePrice' 'LicenseIncluded' |
longTermRetentionBackupResourceId | The resource identifier of the long term retention backup associated with create operation of this database. | string |
maintenanceConfigurationId | Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates will occur. | string |
manualCutover | Whether or not customer controlled manual cutover needs to be done during Update Database operation to Hyperscale tier. This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to Hyperscale tier. When manualCutover is specified, the scaling operation will wait for user input to trigger cutover to Hyperscale database. To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in Waiting state. |
bool |
maxSizeBytes | The max size of the database expressed in bytes. | int |
minCapacity | Minimal capacity that database will always have allocated, if not paused | int |
performCutover | To trigger customer controlled manual cutover during the wait state while Scaling operation is in progress. This property parameter is only applicable for scaling operations that are initiated along with 'manualCutover' parameter. This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to Hyperscale tier is already in progress. When performCutover is specified, the scaling operation will trigger cutover and perform role-change to Hyperscale database. |
bool |
preferredEnclaveType | Type of enclave requested on the database i.e. Default or VBS enclaves. | 'Default' 'VBS' |
readScale | The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool. | 'Disabled' 'Enabled' |
recoverableDatabaseId | The resource identifier of the recoverable database associated with create operation of this database. | string |
recoveryServicesRecoveryPointId | The resource identifier of the recovery point associated with create operation of this database. | string |
requestedBackupStorageRedundancy | The storage account type to be used to store backups for this database. | 'Geo' 'GeoZone' 'Local' 'Zone' |
restorableDroppedDatabaseId | The resource identifier of the restorable dropped database associated with create operation of this database. | string |
restorePointInTime | Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. | string |
sampleName | The name of the sample schema to apply when creating this database. | 'AdventureWorksLT' 'WideWorldImportersFull' 'WideWorldImportersStd' |
secondaryType | The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby. | 'Geo' 'Named' 'Standby' |
sourceDatabaseDeletionDate | Specifies the time that the database was deleted. | string |
sourceDatabaseId | The resource identifier of the source database associated with create operation of this database. | string |
sourceResourceId | The resource identifier of the source associated with the create operation of this database. This property is only supported for DataWarehouse edition and allows to restore across subscriptions. When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or existing sql pool, and restorePointInTime must be specified. When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped sql pool. When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool. When source subscription belongs to a different tenant than target subscription, “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details about “x-ms-authorization-auxiliary” header see /azure/azure-resource-manager/management/authenticate-multi-tenant |
string |
zoneRedundant | Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. | bool |
DatabasePropertiesKeys
Name | Description | Value |
---|
DatabaseUserIdentity
Name | Description | Value |
---|
Microsoft.Sql/servers/databases
Name | Description | Value |
---|---|---|
identity | The Azure Active Directory identity of the database. | DatabaseIdentity |
location | Resource location. | string (required) |
name | The resource name | string (required) |
parent | In Bicep, you can specify the parent resource for a child resource. You only need to add this property when the child resource is declared outside of the parent resource. For more information, see Child resource outside parent resource. |
Symbolic name for resource of type: servers |
properties | Resource properties. | DatabaseProperties |
sku | The database SKU. The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the Capabilities_ListByLocation REST API or one of the following commands:azurecli<br />az sql db list-editions -l <location> -o table<br />````<br /><br /> powershellGet-AzSqlServerServiceObjective -Location <location> ```` |
Sku |
tags | Resource tags | Dictionary of tag names and values. See Tags in templates |
Sku
Name | Description | Value |
---|---|---|
capacity | Capacity of the particular SKU. | int |
family | If the service has different generations of hardware, for the same SKU, then that can be captured here. | string |
name | The name of the SKU, typically, a letter + Number code, e.g. P3. | string (required) |
size | Size of the particular SKU | string |
tier | The tier or edition of the particular SKU, e.g. Basic, Premium. | string |
TrackedResourceTags
Name | Description | Value |
---|
Quickstart samples
The following quickstart samples deploy this resource type.
Bicep File | Description |
---|---|
Azure SQL Server with Auditing written to Log Analytics | This template allows you to deploy an Azure SQL server with Auditing enabled to write audit logs to Log Analytics (OMS workspace) |
Create a SQL Server and Database | This template allows you to create SQL Database and Server. |
Dedicated SQL pool with Transparent Encryption | Creates a SQL Server and a Dedicated SQL pool (formerly SQL DW) with Transparent Data Encryption. |
Deploy the Sports Analytics on Azure Architecture | Creates an Azure storage account with ADLS Gen 2 enabled, an Azure Data Factory instance with linked services for the storage account (an the Azure SQL Database if deployed), and an Azure Databricks instance. The AAD identity for the user deploying the template and the managed identity for the ADF instance will be granted the Storage Blob Data Contributor role on the storage account. There are also options to deploy an Azure Key Vault instance, an Azure SQL Database, and an Azure Event Hub (for streaming use cases). When an Azure Key Vault is deployed, the data factory managed identity and the AAD identity for the user deploying the template will be granted the Key Vault Secrets User role. |
Private Endpoint example | This template shows how to create a private endpoint pointing to Azure SQL Server |
Provision a Web App with a SQL Database | This template provisions a Web App, a SQL Database, AutoScale settings, Alert rules, and App Insights. It configures a connection string in the web app for the database. |
Sonarqube Docker Web App on Linux with Azure SQL | This template deploys Sonarqube in an Azure App Service web app Linux container using the official Sonarqube image and backed by an Azure SQL Server. |
Web App with Managed Identity, SQL Server and ΑΙ | Simple example to deploy Azure infrastructure for app + data + managed identity + monitoring |
ARM template resource definition
The servers/databases resource type can be deployed with operations that target:
- Resource groups - See resource group deployment commands
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Sql/servers/databases resource, add the following JSON to your template.
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2022-08-01-preview",
"name": "string",
"identity": {
"type": "string",
"userAssignedIdentities": {
"{customized property}": {
}
}
},
"location": "string",
"properties": {
"autoPauseDelay": "int",
"availabilityZone": "string",
"catalogCollation": "string",
"collation": "string",
"createMode": "string",
"elasticPoolId": "string",
"encryptionProtector": "string",
"federatedClientId": "string",
"highAvailabilityReplicaCount": "int",
"isLedgerOn": "bool",
"keys": {
"{customized property}": {
}
},
"licenseType": "string",
"longTermRetentionBackupResourceId": "string",
"maintenanceConfigurationId": "string",
"manualCutover": "bool",
"maxSizeBytes": "int",
"minCapacity": "int",
"performCutover": "bool",
"preferredEnclaveType": "string",
"readScale": "string",
"recoverableDatabaseId": "string",
"recoveryServicesRecoveryPointId": "string",
"requestedBackupStorageRedundancy": "string",
"restorableDroppedDatabaseId": "string",
"restorePointInTime": "string",
"sampleName": "string",
"secondaryType": "string",
"sourceDatabaseDeletionDate": "string",
"sourceDatabaseId": "string",
"sourceResourceId": "string",
"zoneRedundant": "bool"
},
"sku": {
"capacity": "int",
"family": "string",
"name": "string",
"size": "string",
"tier": "string"
},
"tags": {
"{customized property}": "string"
}
}
Property values
DatabaseIdentity
Name | Description | Value |
---|---|---|
type | The identity type | 'None' 'UserAssigned' |
userAssignedIdentities | The resource ids of the user assigned identities to use | DatabaseIdentityUserAssignedIdentities |
DatabaseIdentityUserAssignedIdentities
Name | Description | Value |
---|
DatabaseKey
Name | Description | Value |
---|
DatabaseProperties
Name | Description | Value |
---|---|---|
autoPauseDelay | Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled | int |
availabilityZone | Specifies the availability zone the database is pinned to. | '1' '2' '3' 'NoPreference' |
catalogCollation | Collation of the metadata catalog. | 'DATABASE_DEFAULT' 'SQL_Latin1_General_CP1_CI_AS' |
collation | The collation of the database. | string |
createMode | Specifies the mode of database creation. Default: regular database creation. Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. |
'Copy' 'Default' 'OnlineSecondary' 'PointInTimeRestore' 'Recovery' 'Restore' 'RestoreExternalBackup' 'RestoreExternalBackupSecondary' 'RestoreLongTermRetentionBackup' 'Secondary' |
elasticPoolId | The resource identifier of the elastic pool containing this database. | string |
encryptionProtector | The azure key vault URI of the database if it's configured with per Database Customer Managed Keys. | string |
federatedClientId | The Client id used for cross tenant per database CMK scenario | string Constraints: Min length = 36 Max length = 36 Pattern = ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$ |
highAvailabilityReplicaCount | The number of secondary replicas associated with the database that are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. | int |
isLedgerOn | Whether or not this database is a ledger database, which means all tables in the database are ledger tables. Note: the value of this property cannot be changed after the database has been created. | bool |
keys | The resource ids of the user assigned identities to use | DatabasePropertiesKeys |
licenseType | The license type to apply for this database. LicenseIncluded if you need a license, or BasePrice if you have a license and are eligible for the Azure Hybrid Benefit. |
'BasePrice' 'LicenseIncluded' |
longTermRetentionBackupResourceId | The resource identifier of the long term retention backup associated with create operation of this database. | string |
maintenanceConfigurationId | Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates will occur. | string |
manualCutover | Whether or not customer controlled manual cutover needs to be done during Update Database operation to Hyperscale tier. This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to Hyperscale tier. When manualCutover is specified, the scaling operation will wait for user input to trigger cutover to Hyperscale database. To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in Waiting state. |
bool |
maxSizeBytes | The max size of the database expressed in bytes. | int |
minCapacity | Minimal capacity that database will always have allocated, if not paused | int |
performCutover | To trigger customer controlled manual cutover during the wait state while Scaling operation is in progress. This property parameter is only applicable for scaling operations that are initiated along with 'manualCutover' parameter. This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to Hyperscale tier is already in progress. When performCutover is specified, the scaling operation will trigger cutover and perform role-change to Hyperscale database. |
bool |
preferredEnclaveType | Type of enclave requested on the database i.e. Default or VBS enclaves. | 'Default' 'VBS' |
readScale | The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool. | 'Disabled' 'Enabled' |
recoverableDatabaseId | The resource identifier of the recoverable database associated with create operation of this database. | string |
recoveryServicesRecoveryPointId | The resource identifier of the recovery point associated with create operation of this database. | string |
requestedBackupStorageRedundancy | The storage account type to be used to store backups for this database. | 'Geo' 'GeoZone' 'Local' 'Zone' |
restorableDroppedDatabaseId | The resource identifier of the restorable dropped database associated with create operation of this database. | string |
restorePointInTime | Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. | string |
sampleName | The name of the sample schema to apply when creating this database. | 'AdventureWorksLT' 'WideWorldImportersFull' 'WideWorldImportersStd' |
secondaryType | The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby. | 'Geo' 'Named' 'Standby' |
sourceDatabaseDeletionDate | Specifies the time that the database was deleted. | string |
sourceDatabaseId | The resource identifier of the source database associated with create operation of this database. | string |
sourceResourceId | The resource identifier of the source associated with the create operation of this database. This property is only supported for DataWarehouse edition and allows to restore across subscriptions. When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or existing sql pool, and restorePointInTime must be specified. When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped sql pool. When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool. When source subscription belongs to a different tenant than target subscription, “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details about “x-ms-authorization-auxiliary” header see /azure/azure-resource-manager/management/authenticate-multi-tenant |
string |
zoneRedundant | Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. | bool |
DatabasePropertiesKeys
Name | Description | Value |
---|
DatabaseUserIdentity
Name | Description | Value |
---|
Microsoft.Sql/servers/databases
Name | Description | Value |
---|---|---|
apiVersion | The api version | '2022-08-01-preview' |
identity | The Azure Active Directory identity of the database. | DatabaseIdentity |
location | Resource location. | string (required) |
name | The resource name | string (required) |
properties | Resource properties. | DatabaseProperties |
sku | The database SKU. The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the Capabilities_ListByLocation REST API or one of the following commands:azurecli<br />az sql db list-editions -l <location> -o table<br />````<br /><br /> powershellGet-AzSqlServerServiceObjective -Location <location> ```` |
Sku |
tags | Resource tags | Dictionary of tag names and values. See Tags in templates |
type | The resource type | 'Microsoft.Sql/servers/databases' |
Sku
Name | Description | Value |
---|---|---|
capacity | Capacity of the particular SKU. | int |
family | If the service has different generations of hardware, for the same SKU, then that can be captured here. | string |
name | The name of the SKU, typically, a letter + Number code, e.g. P3. | string (required) |
size | Size of the particular SKU | string |
tier | The tier or edition of the particular SKU, e.g. Basic, Premium. | string |
TrackedResourceTags
Name | Description | Value |
---|
Quickstart templates
The following quickstart templates deploy this resource type.
Template | Description |
---|---|
Azure SQL Server with Auditing written to Log Analytics |
This template allows you to deploy an Azure SQL server with Auditing enabled to write audit logs to Log Analytics (OMS workspace) |
Create a SQL Server and Database |
This template allows you to create SQL Database and Server. |
Dedicated SQL pool with Transparent Encryption |
Creates a SQL Server and a Dedicated SQL pool (formerly SQL DW) with Transparent Data Encryption. |
Deploy a new SQL Elastic Pool |
This template allows you to deploy a new SQL Elastic Pool with its new associated SQL Server and new SQL Databases to assign to it. |
Deploy the Sports Analytics on Azure Architecture |
Creates an Azure storage account with ADLS Gen 2 enabled, an Azure Data Factory instance with linked services for the storage account (an the Azure SQL Database if deployed), and an Azure Databricks instance. The AAD identity for the user deploying the template and the managed identity for the ADF instance will be granted the Storage Blob Data Contributor role on the storage account. There are also options to deploy an Azure Key Vault instance, an Azure SQL Database, and an Azure Event Hub (for streaming use cases). When an Azure Key Vault is deployed, the data factory managed identity and the AAD identity for the user deploying the template will be granted the Key Vault Secrets User role. |
HDInsight with custom Ambari + Hive Metastore DB in VNET |
This template allows you to create an HDInsight cluster in an existing virtual network with a new SQL DB that serves as both a custom Ambari DB and Hive Metastore. You must have an existing SQL Sever, storage account, and VNET. |
Private Endpoint example |
This template shows how to create a private endpoint pointing to Azure SQL Server |
Provision a Web App with a SQL Database |
This template provisions a Web App, a SQL Database, AutoScale settings, Alert rules, and App Insights. It configures a connection string in the web app for the database. |
Remote Desktop Services with High Availability |
This ARM Template sample code will deploy a Remote Desktop Services 2019 Session Collection lab with high availability. The goal is to deploy a fully redundant, highly available solution for Remote Desktop Services, using Windows Server 2019. |
Sonarqube Docker Web App on Linux with Azure SQL |
This template deploys Sonarqube in an Azure App Service web app Linux container using the official Sonarqube image and backed by an Azure SQL Server. |
Web App with Managed Identity, SQL Server and ΑΙ |
Simple example to deploy Azure infrastructure for app + data + managed identity + monitoring |
WebApp consuming a Azure SQL Private Endpoint |
This template shows how to create a Web app that consumes a private endpoint pointing to Azure SQL Server |
Terraform (AzAPI provider) resource definition
The servers/databases resource type can be deployed with operations that target:
- Resource groups
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Sql/servers/databases resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Sql/servers/databases@2022-08-01-preview"
name = "string"
identity = {
type = "string"
userAssignedIdentities = {
{customized property} = {
}
}
}
location = "string"
sku = {
capacity = int
family = "string"
name = "string"
size = "string"
tier = "string"
}
tags = {
{customized property} = "string"
}
body = jsonencode({
properties = {
autoPauseDelay = int
availabilityZone = "string"
catalogCollation = "string"
collation = "string"
createMode = "string"
elasticPoolId = "string"
encryptionProtector = "string"
federatedClientId = "string"
highAvailabilityReplicaCount = int
isLedgerOn = bool
keys = {
{customized property} = {
}
}
licenseType = "string"
longTermRetentionBackupResourceId = "string"
maintenanceConfigurationId = "string"
manualCutover = bool
maxSizeBytes = int
minCapacity = int
performCutover = bool
preferredEnclaveType = "string"
readScale = "string"
recoverableDatabaseId = "string"
recoveryServicesRecoveryPointId = "string"
requestedBackupStorageRedundancy = "string"
restorableDroppedDatabaseId = "string"
restorePointInTime = "string"
sampleName = "string"
secondaryType = "string"
sourceDatabaseDeletionDate = "string"
sourceDatabaseId = "string"
sourceResourceId = "string"
zoneRedundant = bool
}
})
}
Property values
DatabaseIdentity
Name | Description | Value |
---|---|---|
type | The identity type | 'None' 'UserAssigned' |
userAssignedIdentities | The resource ids of the user assigned identities to use | DatabaseIdentityUserAssignedIdentities |
DatabaseIdentityUserAssignedIdentities
Name | Description | Value |
---|
DatabaseKey
Name | Description | Value |
---|
DatabaseProperties
Name | Description | Value |
---|---|---|
autoPauseDelay | Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled | int |
availabilityZone | Specifies the availability zone the database is pinned to. | '1' '2' '3' 'NoPreference' |
catalogCollation | Collation of the metadata catalog. | 'DATABASE_DEFAULT' 'SQL_Latin1_General_CP1_CI_AS' |
collation | The collation of the database. | string |
createMode | Specifies the mode of database creation. Default: regular database creation. Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. |
'Copy' 'Default' 'OnlineSecondary' 'PointInTimeRestore' 'Recovery' 'Restore' 'RestoreExternalBackup' 'RestoreExternalBackupSecondary' 'RestoreLongTermRetentionBackup' 'Secondary' |
elasticPoolId | The resource identifier of the elastic pool containing this database. | string |
encryptionProtector | The azure key vault URI of the database if it's configured with per Database Customer Managed Keys. | string |
federatedClientId | The Client id used for cross tenant per database CMK scenario | string Constraints: Min length = 36 Max length = 36 Pattern = ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$ |
highAvailabilityReplicaCount | The number of secondary replicas associated with the database that are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. | int |
isLedgerOn | Whether or not this database is a ledger database, which means all tables in the database are ledger tables. Note: the value of this property cannot be changed after the database has been created. | bool |
keys | The resource ids of the user assigned identities to use | DatabasePropertiesKeys |
licenseType | The license type to apply for this database. LicenseIncluded if you need a license, or BasePrice if you have a license and are eligible for the Azure Hybrid Benefit. |
'BasePrice' 'LicenseIncluded' |
longTermRetentionBackupResourceId | The resource identifier of the long term retention backup associated with create operation of this database. | string |
maintenanceConfigurationId | Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates will occur. | string |
manualCutover | Whether or not customer controlled manual cutover needs to be done during Update Database operation to Hyperscale tier. This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to Hyperscale tier. When manualCutover is specified, the scaling operation will wait for user input to trigger cutover to Hyperscale database. To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in Waiting state. |
bool |
maxSizeBytes | The max size of the database expressed in bytes. | int |
minCapacity | Minimal capacity that database will always have allocated, if not paused | int |
performCutover | To trigger customer controlled manual cutover during the wait state while Scaling operation is in progress. This property parameter is only applicable for scaling operations that are initiated along with 'manualCutover' parameter. This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to Hyperscale tier is already in progress. When performCutover is specified, the scaling operation will trigger cutover and perform role-change to Hyperscale database. |
bool |
preferredEnclaveType | Type of enclave requested on the database i.e. Default or VBS enclaves. | 'Default' 'VBS' |
readScale | The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool. | 'Disabled' 'Enabled' |
recoverableDatabaseId | The resource identifier of the recoverable database associated with create operation of this database. | string |
recoveryServicesRecoveryPointId | The resource identifier of the recovery point associated with create operation of this database. | string |
requestedBackupStorageRedundancy | The storage account type to be used to store backups for this database. | 'Geo' 'GeoZone' 'Local' 'Zone' |
restorableDroppedDatabaseId | The resource identifier of the restorable dropped database associated with create operation of this database. | string |
restorePointInTime | Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. | string |
sampleName | The name of the sample schema to apply when creating this database. | 'AdventureWorksLT' 'WideWorldImportersFull' 'WideWorldImportersStd' |
secondaryType | The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby. | 'Geo' 'Named' 'Standby' |
sourceDatabaseDeletionDate | Specifies the time that the database was deleted. | string |
sourceDatabaseId | The resource identifier of the source database associated with create operation of this database. | string |
sourceResourceId | The resource identifier of the source associated with the create operation of this database. This property is only supported for DataWarehouse edition and allows to restore across subscriptions. When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or existing sql pool, and restorePointInTime must be specified. When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped sql pool. When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool. When source subscription belongs to a different tenant than target subscription, “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details about “x-ms-authorization-auxiliary” header see /azure/azure-resource-manager/management/authenticate-multi-tenant |
string |
zoneRedundant | Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. | bool |
DatabasePropertiesKeys
Name | Description | Value |
---|
DatabaseUserIdentity
Name | Description | Value |
---|
Microsoft.Sql/servers/databases
Name | Description | Value |
---|---|---|
identity | The Azure Active Directory identity of the database. | DatabaseIdentity |
location | Resource location. | string (required) |
name | The resource name | string (required) |
parent_id | The ID of the resource that is the parent for this resource. | ID for resource of type: servers |
properties | Resource properties. | DatabaseProperties |
sku | The database SKU. The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the Capabilities_ListByLocation REST API or one of the following commands:azurecli<br />az sql db list-editions -l <location> -o table<br />````<br /><br /> powershellGet-AzSqlServerServiceObjective -Location <location> ```` |
Sku |
tags | Resource tags | Dictionary of tag names and values. |
type | The resource type | "Microsoft.Sql/servers/databases@2022-08-01-preview" |
Sku
Name | Description | Value |
---|---|---|
capacity | Capacity of the particular SKU. | int |
family | If the service has different generations of hardware, for the same SKU, then that can be captured here. | string |
name | The name of the SKU, typically, a letter + Number code, e.g. P3. | string (required) |
size | Size of the particular SKU | string |
tier | The tier or edition of the particular SKU, e.g. Basic, Premium. | string |
TrackedResourceTags
Name | Description | Value |
---|