Microsoft.Sql servers/databases template reference

Template format

To create a Microsoft.Sql/servers/databases resource, add the following JSON to the resources section of your template.

{
  "name": "string",
  "type": "Microsoft.Sql/servers/databases",
  "apiVersion": "2017-10-01-preview",
  "location": "string",
  "tags": {},
  "sku": {
    "name": "string",
    "tier": "string",
    "size": "string",
    "family": "string",
    "capacity": "integer"
  },
  "properties": {
    "createMode": "string",
    "collation": "string",
    "maxSizeBytes": "integer",
    "sampleName": "string",
    "elasticPoolId": "string",
    "sourceDatabaseId": "string",
    "restorePointInTime": "string",
    "sourceDatabaseDeletionDate": "string",
    "recoveryServicesRecoveryPointId": "string",
    "longTermRetentionBackupResourceId": "string",
    "recoverableDatabaseId": "string",
    "restorableDroppedDatabaseId": "string",
    "catalogCollation": "string",
    "zoneRedundant": "boolean",
    "licenseType": "string",
    "readScale": "string",
    "readReplicaCount": "integer",
    "autoPauseDelay": "integer",
    "minCapacity": "number"
  }
}

Property values

The following tables describe the values you need to set in the schema.

Microsoft.Sql/servers/databases object

Name Type Required Value
name string Yes The name of the database to be operated on (updated or created).
type enum Yes databases
-or-
Microsoft.Sql/servers/databases

See Set name and type for child resources.
apiVersion enum Yes 2017-10-01-preview
location string Yes Resource location.
tags object No Resource tags.
sku object No 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:

az sql db list-editions -l <location> -o table

Get-AzSqlServerServiceObjective -Location <location>
- Sku object
properties object Yes Resource properties. - DatabaseProperties object

Sku object

Name Type Required Value
name string Yes The name of the SKU, typically, a letter + Number code, e.g. P3.
tier string No The tier or edition of the particular SKU, e.g. Basic, Premium.
size string No Size of the particular SKU
family string No If the service has different generations of hardware, for the same SKU, then that can be captured here.
capacity integer No Capacity of the particular SKU.

DatabaseProperties object

Name Type Required Value
createMode enum No 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. - Default, Copy, Secondary, PointInTimeRestore, Restore, Recovery, RestoreExternalBackup, RestoreExternalBackupSecondary, RestoreLongTermRetentionBackup, OnlineSecondary
collation string No The collation of the database.
maxSizeBytes integer No The max size of the database expressed in bytes.
sampleName enum No The name of the sample schema to apply when creating this database. - AdventureWorksLT, WideWorldImportersStd, WideWorldImportersFull
elasticPoolId string No The resource identifier of the elastic pool containing this database.
sourceDatabaseId string No The resource identifier of the source database associated with create operation of this database.
restorePointInTime string No Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.
sourceDatabaseDeletionDate string No Specifies the time that the database was deleted.
recoveryServicesRecoveryPointId string No The resource identifier of the recovery point associated with create operation of this database.
longTermRetentionBackupResourceId string No The resource identifier of the long term retention backup associated with create operation of this database.
recoverableDatabaseId string No The resource identifier of the recoverable database associated with create operation of this database.
restorableDroppedDatabaseId string No The resource identifier of the restorable dropped database associated with create operation of this database.
catalogCollation enum No Collation of the metadata catalog. - DATABASE_DEFAULT or SQL_Latin1_General_CP1_CI_AS
zoneRedundant boolean No Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones.
licenseType enum No The license type to apply for this database. - LicenseIncluded or BasePrice
readScale enum No If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases. - Enabled or Disabled
readReplicaCount integer No The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed. This property is only settable for Hyperscale edition databases.
autoPauseDelay integer No Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled
minCapacity number No Minimal capacity that database will always have allocated, if not paused

Quickstart templates

The following quickstart templates deploy this resource type.