How to pass ConnectionString when deploying AzureRM Web App in TFS?

230 views Asked by At

I am struggling to pass ConnectionString when deploying AzureRM Web App in TFS Release Manager. I have tried to put the ConnectionString in the "Additional Arguments" field and provided the correct variables from the "Variables" section. However, I am getting the following error:

enter image description here

[error] Error: Unrecognized argument '-connectionString'. Error count: 1.

Does someone have experience in how to set up ConnectionString when working with AzureRM Endpoint to deploy Web Apps? As far as I know, the approach described above works fine when using Azure Web App Deployment with Azure Classic Endpoint.

2

There are 2 answers

0
PatrickLu-MSFT On

You could also try to use some 3-party extension such as Azure WebApp Configuration task.

This task reads VSTS/TFS variables and adds those as AppSettings and ConnectionStrings to an Azure WebApp.

enter image description here

0
AjayKumar On

You could inculcate the following sample, to fit your deployment via TFS.

{
      "apiVersion": "2014-11-01",
      "name": "appsettings",
      "type": "config",
      "dependsOn": [
        "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
      ],
      "properties": {
        "AppSettingKey1": "Some value",
        "AppSettingKey2": "My second setting",
        "AppSettingKey3": "My third setting"
      }
    },
    {
      "apiVersion": "2014-11-01",
      "name": "connectionstrings",
      "type": "config",
      "dependsOn": [
        "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
      ],
      "properties": {
        "ConnString1": { "value": "My custom connection string", "type": "custom" },
        "ConnString2": { "value": "My SQL connection string", "type": "SQLAzure" }
      }
    },

Refer the sample here for more details