azure-docs icon indicating copy to clipboard operation
azure-docs copied to clipboard

Microsoft.Web sites/config 'connectionstrings' could be clearer about the format of properties

Open aolszowka opened this issue 2 years ago • 3 comments

The Microsoft.Web sites/config 'connectionstrings' documentation (located currently at https://learn.microsoft.com/en-us/azure/templates/microsoft.web/sites/config-connectionstrings?pivots=deployment-language-arm-template) could be clearer about the format in which it expects connection strings to be given to it.

The current documentation looks like this:

{
  "type": "Microsoft.Web/sites/config",
  "apiVersion": "2022-03-01",
  "name": "connectionstrings",
  "kind": "string",
  "properties": {}
}

The area I want to focus is the properties property.

The documentation currently states:

properties Connection strings. object

This isn't super helpful. Thankfully one of the Quick Start Templates (this one in particular https://github.com/Azure/azure-quickstart-templates/blob/master/quickstarts/microsoft.web/web-app-sql-database/azuredeploy.json) shows that this needs to be given in the following format:

"properties": {
  "ConnectionStringName": {
     "value": "ConnectionStringHere",
     "type": "ConnectionType"
  }
}

Testing has shown that you can insert multiple connection strings in here (as expected).

It would be helpful to have this clearly called out as it was not immediately apparent.

The following toy resource definition worked for me:

{
            "type": "Microsoft.Web/sites/config",
            "apiVersion": "2022-03-01",
            "name": "[concat(variables('webSiteName'), '/connectionstrings')]",
            "dependsOn": [
                "[resourceId('Microsoft.Sql/managedInstances', variables('sqlManagedInstanceName'))]",
                "[resourceId('Microsoft.Web/sites', variables('webSiteName'))]"
            ],
            "properties": {
                "AdventureWorksConnectionString": {
                    "value": "ConnectionString1",
                    "type": "SQLServer"
                },
                "AdventureWorks2ConnectionString": {
                    "value": "ConnectionString2",
                    "type": "SQLServer"
                }
            }
        }

aolszowka avatar Dec 15 '22 16:12 aolszowka

@aolszowka

It would be great if you could add a link to the documentation you are following for these steps? This would help us redirect the issue to the appropriate team. Thanks!!

@RamanathanChinnappan-MSFT https://learn.microsoft.com/en-us/azure/templates/microsoft.web/sites/config-connectionstrings?pivots=deployment-language-arm-template

aolszowka avatar Dec 16 '22 03:12 aolszowka

@aolszowka

I've delegated this to content author @tfitzmac to review and share his valuable insights.