Azure / azure-cli

Azure Command-Line Interface
MIT License
3.97k stars 2.95k forks source link

Azure Sql: Wrong capacity when switching from serverless vCore to DTU #23243

Open jensbarthel opened 2 years ago

jensbarthel commented 2 years ago

Related command az sql db update

Describe the bug Updating from a serverless vCore service model with capacity 2 to a DTU model with service objective 3 sets a wrong capacity.

To Reproduce The first cli call sets the db to vCore serverless, the second switches to DTU with implied capacity 100 (service-objective S3) which reveals the bug.

az sql db update \
    --compute-model Serverless \
    --capacity 2 \
    --edition GeneralPurpose \
    --family Gen5 \
    --resource-group ResourceGroup \
    --server uniform-name \
    --name uniform-name \
&& \
az sql db update \
    --edition Standard \
    --service-objective S3 \
    --resource-group ResourceGroup \
    --server uniform-name \
    --name uniform-name

Eventually yields

{
"currentServiceObjectiveName": "S0",
"requestedServiceObjectiveName": "S0",
  "sku": {
    "capacity": 10,
    "family": null,
    "name": "Standard",
    "size": null,
    "tier": "Standard"
  }
}

The lack of capacity is confirmed by

Please see the additional context for the full command output.

Expected behavior The update command should

Environment summary

Additional context Running

az sql db update \
    --edition Standard \
    --service-objective S3 \
    --resource-group ResourceGroup \
    --server uniform-name \
    --name uniform-name

again sets the capacity correctly.

Full command output:

{
  "autoPauseDelay": 60,
  "catalogCollation": "SQL_Latin1_General_CP1_CI_AS",
  "collation": "SQL_Latin1_General_CP1_CI_AS",
  "createMode": null,
  "creationDate": "2022-03-15T12:57:22.940000+00:00",
  "currentBackupStorageRedundancy": "Local",
  "currentServiceObjectiveName": "GP_S_Gen5_2",
  "currentSku": {
    "capacity": 2,
    "family": "Gen5",
    "name": "GP_S_Gen5",
    "size": null,
    "tier": "GeneralPurpose"
  },
  "databaseId": "some-id",
  "defaultSecondaryLocation": "northeurope",
  "earliestRestoreDate": "2022-07-11T13:00:42.789103+00:00",
  "edition": "GeneralPurpose",
  "elasticPoolId": null,
  "elasticPoolName": null,
  "failoverGroupId": null,
  "federatedClientId": null,
  "highAvailabilityReplicaCount": null,
  "id": "/subscriptions/<subscription>/resourceGroups/ResourceGroup/providers/Microsoft.Sql/servers/uniform-name/databases/uniform-name",
  "identity": null,
  "isInfraEncryptionEnabled": false,
  "kind": "v12.0,user,vcore,serverless",
  "ledgerOn": false,
  "licenseType": null,
  "location": "westeurope",
  "longTermRetentionBackupResourceId": null,
  "maintenanceConfigurationId": "/subscriptions/<subscription>/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default",
  "managedBy": null,
  "maxLogSizeBytes": 193273528320,
  "maxSizeBytes": 268435456000,
  "minCapacity": 0.5,
  "name": "uniform-name",
  "pausedDate": null,
  "primaryDelegatedIdentityClientId": null,
  "readScale": "Disabled",
  "recoverableDatabaseId": null,
  "recoveryServicesRecoveryPointId": null,
  "requestedBackupStorageRedundancy": "Local",
  "requestedServiceObjectiveName": "GP_S_Gen5_2",
  "resourceGroup": "ResourceGroup",
  "restorableDroppedDatabaseId": null,
  "restorePointInTime": null,
  "resumedDate": "2022-07-18T12:36:08.947000+00:00",
  "sampleName": null,
  "secondaryType": null,
  "sku": {
    "capacity": 2,
    "family": "Gen5",
    "name": "GP_S_Gen5",
    "size": null,
    "tier": "GeneralPurpose"
  },
  "sourceDatabaseDeletionDate": null,
  "sourceDatabaseId": null,
  "status": "Online",
  "tags": {
    "managed-by": "pulumi",
    "pulumi-project-name": "some-project",
    "stage": "qa"
  },
  "type": "Microsoft.Sql/servers/databases",
  "zoneRedundant": false
}
{
  "autoPauseDelay": null,
  "catalogCollation": "SQL_Latin1_General_CP1_CI_AS",
  "collation": "SQL_Latin1_General_CP1_CI_AS",
  "createMode": null,
  "creationDate": "2022-03-15T12:57:22.940000+00:00",
  "currentBackupStorageRedundancy": "Local",
  "currentServiceObjectiveName": "S0",
  "currentSku": {
    "capacity": 10,
    "family": null,
    "name": "Standard",
    "size": null,
    "tier": "Standard"
  },
  "databaseId": "some-id",
  "defaultSecondaryLocation": "northeurope",
  "earliestRestoreDate": "2022-07-11T13:02:31.261159+00:00",
  "edition": "Standard",
  "elasticPoolId": null,
  "elasticPoolName": null,
  "failoverGroupId": null,
  "federatedClientId": null,
  "highAvailabilityReplicaCount": null,
  "id": "/subscriptions/<subscription>/resourceGroups/ResourceGroup/providers/Microsoft.Sql/servers/uniform-name/databases/uniform-name",
  "identity": null,
  "isInfraEncryptionEnabled": false,
  "kind": "v12.0,user",
  "ledgerOn": false,
  "licenseType": null,
  "location": "westeurope",
  "longTermRetentionBackupResourceId": null,
  "maintenanceConfigurationId": "/subscriptions/<subscription>/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default",
  "managedBy": null,
  "maxLogSizeBytes": null,
  "maxSizeBytes": 268435456000,
  "minCapacity": null,
  "name": "uniform-name",
  "pausedDate": null,
  "primaryDelegatedIdentityClientId": null,
  "readScale": "Disabled",
  "recoverableDatabaseId": null,
  "recoveryServicesRecoveryPointId": null,
  "requestedBackupStorageRedundancy": "Local",
  "requestedServiceObjectiveName": "S0",
  "resourceGroup": "ResourceGroup",
  "restorableDroppedDatabaseId": null,
  "restorePointInTime": null,
  "resumedDate": null,
  "sampleName": null,
  "secondaryType": null,
  "sku": {
    "capacity": 10,
    "family": null,
    "name": "Standard",
    "size": null,
    "tier": "Standard"
  },
  "sourceDatabaseDeletionDate": null,
  "sourceDatabaseId": null,
  "status": "Online",
  "tags": {
    "managed-by": "pulumi",
    "pulumi-project-name": "some-project",
    "stage": "qa"
  },
  "type": "Microsoft.Sql/servers/databases",
  "zoneRedundant": false
}
yonzhan commented 2 years ago

route to CXP team