ResourceModules icon indicating copy to clipboard operation
ResourceModules copied to clipboard

[Bug Report]: Elastic Pool minCapacity not set causes error 'The service level objective "S2M50" does not support the min capacity '0''

Open zydio opened this issue 3 years ago • 1 comments

Describe the bug

BICEP deployments of Elastic Pools using CARML modules started to fail in the last few days, for what looks like an ARM (server side) issue, as we are using either v0.8.0 or v0.10.0 CARML official release and also without changing anything we started getting the error.

Modifying modules\Microsoft.Sql\servers\elasticPools\deploy.bicep to send a value of null for properties.minCapacity (not properties.perDatabaseSettings.minCapacity which works) solves the problem.

Note that it is currently impossible to send a null value for properties.minCapacity when the Elastic Pool is created when defining it with the properties of modules\Microsoft.Sql\servers\deploy.bicep because this file defaults the parameter to 0 when not provided (which causes the original error) and modules\Microsoft.Sql\servers\elasticPools\deploy.bicep would anyway set a default of 2 (inconsistent with the behavior of the other module) which is equally not accepted by ARM.

To reproduce

Run a deployment with an Elastic Pool, using CARML >= 0.8.0 and <= 0.10.0

Code snippet

module sqlServer 'CARML/modules/Microsoft.Sql/servers/deploy.bicep' = {
  scope: resourceGroup('issue-with-minCapacity-rg')
  name: '${uniqueString(deployment().name)}-SqlServer'
  params: {
    location: 'westeurope'
    name: 'issue-with-minCapacity-sql'
    administratorLogin: 'adminForTicket'
    administratorLoginPassword: 'An1P@sswordYouL1ke'
    minimalTlsVersion: '1.2'
    elasticPools: [{
      name: 'issue-with-minCapacity-ep'
      skuName: 'StandardPool'
      skuTier: 'Standard'
      skuCapacity: 50
      maxSizeBytes: 50*1024*1024*1024
      databaseMinCapacity: 10
      databaseMaxCapacity: 50
      maintenanceConfigurationId: '${subscription().id}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_WestEurope_DB_1'
    }]
    databases: [{
      // An Elastic database in a Pool
      name: 'issue-with-minCapacity-db'
      skuName: 'ElasticPool'
      skuTier: 'Standard'
      skuCapacity: 0
      maxSizeBytes: 30*1024*1024*1024
      zoneRedundant: false
      elasticPoolId: '${subscription().id}/resourceGroups/issue-with-minCapacity-rg/providers/Microsoft.Sql/servers/issue-with-minCapacity-sql/elasticPools/issue-with-minCapacity-ep'
      requestedBackupStorageRedundancy: 'Local'
    }]
  }

Relevant log output

The service level objective "S2M50" does not support the min capacity '0'

zydio avatar Jul 25 '23 16:07 zydio