Search code examples
azureazure-sql-databaseazure-resource-managerazure-bicep

Bicep template for Azure SQL Serverless database


Is Azure SQL Serverless database implementation supported using Bicep? I haven't seen any Bicep examples of it on Web. Most of the examples are using ARM only and the reverse engineering of ARM to Bicep is not working for me. It is just giving internal server error with no more details. Does someone have any working example of it which can be used as a reference? Appreciate your help in advance!


Solution

  • Here is bicep file for reference.

    param servername string = 'mysqlserver-1036050389'
    param location string = 'centralus'
    
    resource servername_resource 'Microsoft.Sql/servers@2022-05-01-preview' = {
      name: servername
      location: location
      properties: {
        administratorLogin: 'azureuser'
        administratorLoginPassword: 'Bigambs123457'
        version: '12.0'
        publicNetworkAccess: 'Enabled'
        restrictOutboundNetworkAccess: 'Disabled'
      }
    }
    
    resource servername_mySampleDatabase 'Microsoft.Sql/servers/databases@2022-05-01-preview' = {
      parent: servername_resource
      name: 'mySampleDatabase'
      location: location
      sku: {
        name: 'GP_S_Gen5'
        tier: 'GeneralPurpose'
        family: 'Gen5'
        capacity: 2
      }
      kind: 'v12.0,user,vcore,serverless'
      properties: {
        collation: 'SQL_Latin1_General_CP1_CI_AS'
        maxSizeBytes: 34359738368
        catalogCollation: 'SQL_Latin1_General_CP1_CI_AS'
        zoneRedundant: false
        readScale: 'Disabled'
        autoPauseDelay: 60
        requestedBackupStorageRedundancy: 'Geo'
        minCapacity: 2
        isLedgerOn: false
        
      }
    }