azSqlDatabase

Use the resource azSqlDatabase to deploy an Azure SQL Database to the relevant subscription.

Attributes

Attribute Type Mandatory Values Default Notes
Name String Yes
ResourceGroupName String Yes
ServerName String Yes
ElasticPoolName String No
DtuModel Object * * Either DtuModel or VCoreModel is mandatory
VCoreModel Object * * Either DtuModel or VCoreModel is mandatory
ServiceObjectiveName String No Edition: Free - Free
Edition: Basic - Basic
Edition: Standard - S0
Edition: Premium - P0
Edition: DataWarehouse - DW100c
Edition: Stretch - DS100
CollationName String No
CatalogCollation String No
ReadScale String No
ComputeModel String No
AutoPauseDelayInMinutes Number No
MinimumCapacity String No
BackupStorageRedundancy String No Local, Zone, Geo, GeoZone
EnableLedger String No
MaxSizeBytes Number No
SecondaryType String No Geo, Named
FailoverGroup String No
Autotuning Object No
Diagnostic Object No
Audit Object No
Replica Object No
Tag Object No
Lock Object No

Dtu Model

The DTU model for measuring capacity has several potential editions.

Attribute Type Mandatory Values Default Notes
Edition String * Free * Either DtuModel or VCoreModel is mandatory
Basic
Standard
Premium
Premium
DataWarehouse
Stretch
Dtu Number

VCore Model

Attribute Type Mandatory Values Default Notes
Edition String * GeneralPurpose * Either DtuModel or VCoreModel is mandatory
BusinessCritical
Hyperscale
VCore Number Yes
ComputeGeneration String No Gen5 (D), FSv2, DC, M
HighAvailabilityReplicaCount Number No Only for Hyperscale edition
LicenseType String Yes BasePrice
LicenseIncluded (D)
ZoneRedundant Boolean

Backup

Attribute Type Mandatory Values Default Notes
StorageRedundancy String No Local (D), Zone, Geo, GeoZone
RetentionDays Number No 7
DiffFrequency Number No 12, 24
LongTermRetention Object No

Backup LongTermRetention

Attribute Type Mandatory Values Default Notes
Weekly Number
Monthly Number
Yearly Number
YearlyWeekRetainer Number

Autotuning

Attribute Type Mandatory Values Default Notes
InheritFrom String No Server, AzureDefaults, DontInherit Server
CreateIndex String No On, Off, Inherit * * Server(Inherit), AzureDefaults(Inherit), DontInherit(Off)
DropIndex String No On, Off, Inherit * * Server(Inherit), AzureDefaults(Inherit), DontInherit(Off)
ForcePlan String No On, Off, Inherit * * Server(Inherit), AzureDefaults(Inherit), DontInherit(On)

Diagnostic

Attribute Type Mandatory Values Default Notes
Name String Yes
Log Object No
Metric Object No
Target Object No

Diagnostic Log

Attribute Type Mandatory Values Default Notes
Enabled Boolean No * Defaults to true if Category is not null
Category Array No AutomaticTuning All
Blocks
Deadlocks
Errors
DatabaseWaitStatistics
QueryStoreRuntimeStatistics
QueryStoreWaitStatistics
SQLInsights Enable SQL Intelligent Insights
Timeouts

Diagnostic Metric

Attribute Type Mandatory Values Default Notes
Enabled Boolean No * Defaults to true if Category is not null
Category Array No Basic All
InstanceAndAppAdvanced
WorkloadManagement

Audit

Attribute Type Mandatory Values Default Notes
PredicateExpression String No
RetentionInDays Number No
ActionGroup Array No
Target Object No

Audit Target

Attribute Type Mandatory Values Default Notes
Blob Object No
EventHub Object No
LogAnalytics Object No
Audit Target Blob
Attribute Type Mandatory Values Default Notes
StorageAccount String Yes
ResourceGroupName String No Defaults to RG of resource
SubscriptionName String No Defaults to Sub of resource
StorageKeyType String Yes Primary, Secondary
Audit Target EventHub
Attribute Type Mandatory Values Default Notes
Name String Yes
Namespace String Yes
ResourceGroupName String No Defaults to RG of resource
SubscriptionName String No Defaults to Sub of resource
SharedAccessPolicy String Defaults to RootManageSharedAccessKey
Audit Target LogAnalytics
Attribute Type Mandatory Values Default Notes
Workspace String Yes
ResourceGroupName String No Defaults to RG of resource
SubscriptionName String No Defaults to Sub of resource

Replica

Attribute Type Mandatory Values Default Notes
Name String
ServerName String
ResourceGroupName String
VCore Number
LicenseType String Base, Base allows for Azure Hybrid Benefit
LicenseIncluded (D) Base allows for Azure Hybrid Benefit
AllowConnections String None, All All
HighAvailabilityReplicaCount Number Only for Hyperscale edition
BackupStorageRedundancy String Local (D), Zone, Geo, GeoZone
ZoneRedundant Boolean True, False (D) Only settable for Hyperscale edition
ElasticPoolName String
ComputeGeneration String Gen5 (D), FSv2, DC, M
Tag Object

Input by YAML

Object model for YAML deployment:

---
azSqlDatabase:
    # Mandatory
  - Name: 'string'
    ResourceGroupName: 'string'
    ServerName: 'string'

    # Specify pool name
    ElasticPoolName: 'string'

    # If no pool name specified
    DtuModel: 
      Edition: 'string'                           # Basic, Standard, Premium
      Dtu: number                                 # Defaults  Basic(5), Standard(100), Premium(125)
    VCoreModel: 
      Edition: 'string'                           # GeneralPurpose, BusinessCritical, Hyperscale
      VCore: number 
      ComputeGeneration: 'string'                 # Gen5 (D), FSv2, DC, M
      HighAvailabilityReplicaCount: number        # Only for Hyperscale edition
      LicenseType: 'string'                       # BasePrice, LicenseIncluded
    ZoneRedundant: boolean                        # True, False (D)

    Backup:
      StorageRedundancy: 'string'                 # Local (D), Zone, Geo, GeoZone
      RetentionDays: number                       # Basic, Fixed 7 days, Standard upwards 1-35 days, (7)
      DiffFrequency: number                       # 12, 24 (D)
      LongTermRetention:
        Weekly: 'string'                          # ISO 8601 format duration, e.g. P10D, P2W, P3Y
        Monthly: 'string'                         # ISO 8601 format duration, e.g. P10D, P2W, P3Y
        Yearly: 'string'                          # ISO 8601 format duration, e.g. P10D, P2W, P3Y
        YearlyWeekRetainer: number                # week number to retain from the yearly

    Autotuning:
      InheritFrom: 'string'                       # DontInherit (D), AzureDefaults, Server
      CreateIndex: 'string'                       # On, Off, Inherit, Defaults DontInherit(Off), AzureDefaults(Inherit), Server(Inherit)
      DropIndex: 'string'                         # On, Off, Inherit, Defaults DontInherit(Off), AzureDefaults(Inherit), Server(Inherit)
      ForcePlan: 'string'                         # On, On, Inherit, Defaults DontInherit(Off), AzureDefaults(Inherit), Server(Inherit)

    # Optional
    CollationName: 'string'  
    CatalogCollation: 'string'
    ReadScale: 'string'                           # Enabled, Disabled   (Only for Premium, Business Critical)
    ComputeModel: 'string'                        # Provisioned (D), Serverless
    AutoPauseDelayInMinutes: number               # Only for Serverless, -1 to opt out
    MinimumCapacity: 'string'                     # Only for Serverless
    EnableLedger: boolean                         # True, False (D)
    MaxSizeBytes: number
    SecondaryType: 'string'                       # Geo, Named
    FailoverGroup: 'string'                       # SQL Database Failover Group
 
    Replica:
      - Name:                                     # Replica db name can be different to the primary db name, defaults to primary
        ServerName: 'string'
        ResourceGroupName: 'string'               # Defaults to RG of primary
        VCore: number
        LicenseType: 'string'                     # Base, LicenseIncluded (D)
        AllowConnections: 'string'                # None, All (D)
        HighAvailabilityReplicaCount: number      # Only for Hyperscale edition
        BackupStorageRedundancy: 'string'         # Local (D), Zone, Geo, GeoZone
        ZoneRedundant: boolean                    # True, False (D), only settable for Hyperscale edition
        ElasticPoolName: 'string'                         
        ComputeGeneration: 'string'               # Gen5 (D), FSv2, DC, M
        Tag:
          'keyvalue-pairs'
  
    Tag:
      'keyvalue-pairs'

    Lock:
      - Name: 'string'
        Level: 'string'                           # CanNotDelete, ReadOnly
        Notes: 'string'

    Diagnostic:
      - Name: 'string'
        Log:
          Enabled: boolean                        # True (D if Category not null), False
          Category: [array]                       # Defaults to all if enabled
        Metric:
          Enabled: boolean                        # True (D if MetricCategory not null), False
          Category: [array]                       # Defaults to all if enabled
        Target:
          Blob:
            StorageAccount: 'string'
            StorageKeyType: 'string'              # Primary, Secondary
            RetentionInDays: number
            ResourceGroupName: 'string'           # Defaults to RG of resource
            SubscriptionName: 'string'            # Defaults to subscription of resource
          EventHub:
            Name: 'string'
            Namespace: 'string'
            SharedAccessPolicy: 'string'          # RootManageSharedAccessKey (D)
            ResourceGroupName: 'string'           # Defaults to RG of resource
            SubscriptionName: 'string'            # Defaults to subscription of resource
          LogAnalytics:
            Workspace: 'string'
            ResourceGroupName: 'string'           # Defaults to RG of resource
            SubscriptionName: 'string'            # Defaults to subscription of resource

Input by JSON

Object model for JSON deployment:

{
  "azSqlDatabase": [
    {
      "Name": "string",
      "ResourceGroupName": "string",
      "ServerName": "string",
      "ElasticPoolName": "string",
      "DtuModel": {
        "Edition": "string",
        "Dtu": number
      },
      "VCoreModel": {
        "Edition": "string",
        "VCore": number,
        "ComputeGeneration": "string",
        "HighAvailabilityReplicaCount": number,
        "LicenseType": "string"
      },
      "ZoneRedundant": boolean,
      "Backup": {
        "StorageRedundancy": "string",
        "RetentionDays": number,
        "DiffFrequency": number,
        "LongTermRetention": {
          "Weekly": number,
          "Monthly": number,
          "Yearly": number,
          "YearlyWeekRetainer": number
        }
      },
      "Autotuning": {
        "InheritFrom": "string",
        "CreateIndex": "string",
        "DropIndex": "string",
        "ForcePlan": "string"
      },
      "CollationName": "string",
      "CatalogCollation": "string",
      "ReadScale": "string",
      "ComputeModel": "string",
      "AutoPauseDelayInMinutes": number,
      "MinimumCapacity": "string",
      "BackupStorageRedundancy": "string",
      "EnableLedger": boolean,
      "MaxSizeBytes": number,
      "SecondaryType": "string",
      "Replica": [
        {
          "Name": "string",
          "ServerName": "string",
          "ResourceGroupName": "string",
          "VCore": number,
          "LicenseType": "string",
          "AllowConnections": "string",
          "HighAvailabilityReplicaCount": number,
          "BackupStorageRedundancy": "string",
          "ZoneRedundant": boolean,
          "ElasticPoolName": "string",
          "ComputeGeneration": "string",
          "ServerName": "string",
          "Tag": {
            "key": "value"
          },
        }
      ],
      "Tag": {
        "key": "string"
      },
      "Lock": [
        {
          "Name": "string",
          "Level": "string",
          "Notes": "string"
        }
      ],
      "Diagnostic": [
        {
          "Name": "string",
          "Log": {
            "Enabled": boolean,
            "Category": [array]
          },
          "Metric": {
            "Enabled": boolean,
            "Category": [array]
          },
          "Target": {
            "Blob": {
              "StorageAccount": "string",
              "StorageKeyType": "string",
              "RetentionInDays": number,
              "ResourceGroupName": "string",
              "SubscriptionName": "string"
            },
            "EventHub": {
              "Name": "string",
              "Namespace": "string",
              "SharedAccessPolicy": "string",
              "ResourceGroupName": "string",
              "SubscriptionName": "string"
            },
            "LogAnalytics": {
              "Workspace": "string",
              "ResourceGroupName": "string",
              "SubscriptionName": "string"
            }
          }
        }
      ]
    }
  ]
}