ARM Template Contact Syntax Error

Contributor

Hi All,

 

I am using concat to create advisors for SQL DB. I am getting this error while using the following resource.

Template is creating Multiple DB's with Advisors.

 

Deployment template language expression evaluation failed: 'Unable to parse language expression 'concat(parameters('serverName'), '/', [array(parameters('databaseNames'))], '/', 'ForceLastGoodPlan')': expected token 'Identifier' and actual 'LeftSquareBracket'.'.
Troubleshooting Options
 
This is the resource section where i am passing Advisors to SQL DB.
 
{
    "type""Microsoft.Sql/servers/databases/advisors",
    "name""[concat(parameters('serverName'), '/', [array(parameters('databaseNames'))], '/', 'ForceLastGoodPlan')]",
    "apiVersion""2014-04-01",
    "scale"null,
    "properties": {
    "autoExecuteValue""Enabled"
    },
    "dependsOn": [
    "[resourceId('Microsoft.Sql/servers', parameters('serverName'))]",
    "[resourceId('Microsoft.Sql/servers/databases', parameters('serverName'), parameters('databaseNames')[copyIndex()])]"


    ]
}
 
Whole Template:
 
{
  "contentVersion""1.0.0.0",
  "parameters": {
    "serverName": {
      "type""String",
      "metadata": {
        "description""Name for the SQL server"
      }
    },
    "databaseNames": {
      "type""Array",
      "metadata": {
        "description""Array of names for the SQL databases"
      }
    },
    "location": {
      "defaultValue""[resourceGroup().location]",
      "type""String",
      "metadata": {
        "description""Location for server and DBs"
      }
    },
    "serverNameExternalid": {
      "type""String"
    },
    "elasticPoolName": {
      "type""String"
    },
    "administratorLogin": {
      "type""string"
    },
    "administratorLoginPassword": {
      "type""securestring"
    }
  },
  "variables": {
  },
  "resources": [
    {
      "type""Microsoft.Sql/servers",
      "apiVersion""2020-02-02-preview",
      "name""[parameters('serverName')]",
      "location""east us",
      "properties": {
        "administratorLogin""[parameters('administratorLogin')]",
        "administratorLoginPassword""[parameters('administratorLoginPassword')]",
        "version""12.0"
      }
    },
    {
      "type""Microsoft.Sql/servers/databases",
      "apiVersion""2020-02-02-preview",
      "name""[concat(string(parameters('serverName')), '/', string(parameters('databaseNames')))]",
      "location""east us",
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', parameters('serverName'))]"
      ],
      "sku": {
        "name""ElasticPool",
        "tier""Standard",
        "capacity"0
      },
      "kind""v12.0,user",
      "properties": {
        "collation""SQL_Latin1_General_CP1_CI_AS",
        "maxSizeBytes"268435456000,
        "elasticPoolId""[concat(parameters('serverNameExternalid'), '/elasticPools/', parameters('elasticPoolName'))]",
        "catalogCollation""SQL_Latin1_General_CP1_CI_AS",
        "zoneRedundant"false,
        "readScale""Disabled",
        "storageAccountType""GRS"
      },
      "resources": [
        {
          "type""securityAlertPolicies",
          "apiVersion""2020-02-02-preview",
          "name""default",
          "dependsOn": [
            "[resourceId('Microsoft.Sql/servers/databases', parameters('serverName'), parameters('databaseNames')[copyIndex()])]"
          ],
          "properties": {
            "state""Enabled"
          }
        },
        {
    "type""Microsoft.Sql/servers/databases/advisors",
    "name""[concat(parameters('serverName'), '/', [array(parameters('databaseNames'))], '/', 'ForceLastGoodPlan')]",
    "apiVersion""2014-04-01",
    "scale"null,
    "properties": {
    "autoExecuteValue""Enabled"
    },
    "dependsOn": [
    "[resourceId('Microsoft.Sql/servers', parameters('serverName'))]",
    "[resourceId('Microsoft.Sql/servers/databases', parameters('serverName'), parameters('databaseNames')[copyIndex()])]"


    ]
}
      ],
      "copy": {
        "name""databaseCopy",
        "count""[length(parameters('databaseNames'))]"
      }
    }
  ]
}
0 Replies