Azure SQL Serverless 数据库的 Bicep 模板

问题描述 投票:0回答:2

是否支持使用 Bicep 实现 Azure SQL Serverless 数据库?我还没有在网上看到任何二头肌示例。大多数示例仅使用 ARM,ARM 到 Bicep 的逆向工程对我来说不起作用。它只是给出内部服务器错误,没有更多详细信息。有人有可以作为参考的工作示例吗?提前感谢您的帮助!

azure azure-sql-database azure-resource-manager azure-bicep
2个回答
1
投票

这是二头肌文件供参考。

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
    
  }
}

0
投票

这是一个最小模板,GP_S_Gen5中的S表示Serverless。

@description('The name of the SQL logical server.')
param serverName string

@description('The name of the SQL Database.')
param databaseName string

@description('The administrator username of the SQL logical server.')
param administratorLogin string

@description('The administrator password of the SQL logical server.')
@secure()
param administratorLoginPassword string

@description('Location for all resources.')
param location string

resource sqlServer 'Microsoft.Sql/servers@2023-08-01-preview' = {
  name: serverName
  location: location
  properties: {
    administratorLogin: administratorLogin
    administratorLoginPassword: administratorLoginPassword
  }
}

resource sqlDB 'Microsoft.Sql/servers/databases@2023-08-01-preview' = {
  parent: sqlServer
  name: databaseName
  location: location
  sku: {
    name: 'GP_S_Gen5'
    tier: 'GeneralPurpose'
    family: 'Gen5'
    capacity: 1
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.