2

I'm trying to deploy a PostgreSQL database via ARM template, along with around 33 config changes during deployment. Some of the configurations are updated but the rest fail with '<server>' is busy with another operation. Please try again later.

Any work-around on this? I'm aware that I could create a script and store in to run, but I'd prefer to keep it ARM templated if possible.

Example of ARM configurations:

{
            "type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
            "apiVersion": "2023-06-01-preview",
            "name": "[concat(variables('postgresdb_name'), '/archive_mode')]",
            "dependsOn": [
                "[resourceId('Microsoft.DBforPostgreSQL/flexibleServers', variables('postgresdb_name'))]"
            ],
            "properties": {
                "value": "always",
                "source": "user-override"
            }

Expected ARM template to deploy PostgreSQL database, along with all configurations

1
  • Issue seems to be with overloading we may need to split the configuration or we may need custom script to run to make delay in between batches deployement @thmswlkr Commented Jul 25, 2024 at 5:02

1 Answer 1

1

PostgreSQL deployment via ARM template failing due to too many configurations' changes.

As per the MSdoc and MSdoc the issue might due to the inconsistent way of providing configuration files and failed to establish the dependancy.

The cause of this can be countered the by making the applying the configurations in smaller batches to avoid unbearable load the server with too many changes at once.

The configuration schema goes as follows

main.bicep:

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "resources": [
    {
      "type": "Microsoft.DBforPostgreSQL/servers",
      "apiVersion": "2017-12-01",
      "name": "[parameters('serverName')]",
      "location": "[parameters('location')]",
      "properties": {
        "administratorLogin": "[parameters('administratorLogin')]",
        "administratorLoginPassword": "[parameters('administratorLoginPassword')]",
        "version": "[parameters('version')]"
      }
    },
    {
      "type": "Microsoft.DBforPostgreSQL/servers/configurations",
      "apiVersion": "2017-12-01",
      "name": "[concat(parameters('serverName'), '/config1')]",
      "dependsOn": [
        "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('serverName'))]"
      ],
      "properties": {
        "value": "[parameters('config1Value')]"
      }
    },
    {
      "type": "Microsoft.DBforPostgreSQL/servers/configurations",
      "apiVersion": "2017-12-01",
      "name": "[concat(parameters('serverName'), '/config2')]",
      "dependsOn": [
        "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('serverName'))]"
      ],
      "properties": {
        "value": "[parameters('config2Value')]"
      }
    },
    {
      "type": "Microsoft.DBforPostgreSQL/servers/configurations",
      "apiVersion": "2017-12-01",
      "name": "[concat(parameters('serverName'), '/config3')]",
      "dependsOn": [
        "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('serverName'))]"
      ],
      "properties": {
        "value": "[parameters('config3Value')]"
      }
    },
    {
      "type": "Microsoft.DBforPostgreSQL/servers/configurations",
      "apiVersion": "2017-12-01",
      "name": "[concat(parameters('serverName'), '/config4')]",
      "dependsOn": [
        "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('serverName'))]"
      ],
      "properties": {
        "value": "[parameters('config4Value')]"
      }
    }
    // Add more configuration resources here in batches
  ],
  "parameters": {
    "serverName": {
      "type": "string"
    },
    "location": {
      "type": "string"
    },
    "administratorLogin": {
      "type": "string"
    },
    "administratorLoginPassword": {
      "type": "securestring"
    },
    "version": {
      "type": "string",
      "defaultValue": "11"
    },
    "config1Value": {
      "type": "string"
    },
    "config2Value": {
      "type": "string"
    },
    "config3Value": {
      "type": "string"
    },
    "config4Value": {
      "type": "string"
    }
  }
}

Deployment:

Depends on the number of configurations the resources will be created without any internal server issue due to load as the configuration was made in batches.

enter image description here

Refer:

Quickstart: Create an Azure Database for PostgreSQL - ARM template | Microsoft Learn

Deploying PostgreSQL Flexible Server with azure.extensions parameter in ARM template fails with InternalServerError - Microsoft Q&A

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.