Azure App Service Settings task

Azure Pipelines

Use this task to configure App settings, connection strings and other general settings in bulk using JSON syntax on your web app or any of its deployment slots. The task works on cross platform Azure Pipelines agents running Windows, Linux or Mac. The task works for ASP.NET, ASP.NET Core, PHP, Java, Python, Go and Node.js based web applications.

Arguments

Parameters Description
ConnectedServiceName
Azure subscription
(Required) Name of the Azure Resource Manager service connection
Argument aliases: ConnectedServiceName
appName
App name
(Required) Name of an existing App Service
resourceGroupName
Resource group
(Required) Name of the resource group
slotName
Slot
(Optional) Name of the slot
Default value: production
appSettings
App settings
(Optional) Application settings to be entered using JSON syntax. Values containing spaces should be enclosed in double quotes.
generalSettings
General settings
(Optional) General settings to be entered using JSON syntax. Values containing spaces should be enclosed in double quotes. See the App Service SiteConfig object documentation for the available properties.
connectionStrings
Connection settings
(Optional) Connection strings to be entered using JSON syntax. Values containing spaces should be enclosed in double quotes.

Following is an example YAML snippet to deploy web application to the Azure Web App service running on windows.

Example


variables:
  azureSubscription: Contoso
  WebApp_Name: sampleWebApp
  # To ignore SSL error uncomment the below variable
  # VSTS_ARM_REST_IGNORE_SSL_ERRORS: true

steps:

- task: AzureWebApp@1
  displayName: Azure Web App Deploy
  inputs:
    azureSubscription: $(azureSubscription)
    appName: $(WebApp_Name)
    package: $(System.DefaultWorkingDirectory)/**/*.zip

- task: AzureAppServiceSettings@1
  displayName: Azure App Service Settings
  inputs:
    azureSubscription: $(azureSubscription)
    appName: $(WebApp_Name)
   # To deploy the settings on a slot, provide slot name as below. By default, the settings would be applied to the actual Web App (Production slot)
   # slotName: staging
    appSettings: |
      [
        {
          "name": "APPINSIGHTS_INSTRUMENTATIONKEY",
          "value": "$(Key)",
          "slotSetting": false
        },
        {
          "name": "MYSQL_DATABASE_NAME",
          "value": "$(DB_Name)", 
          "slotSetting": false
        }
      ]
    generalSettings: |
      [
        {
          "name": "WEBAPP_NAME",
          "value": "$(WebApp_Name)",
          "slotSetting": false
        },
        {
          "name": "WEBAPP_PLAN_NAME",
          "value": "$(WebApp_PlanName)",
          "slotSetting": false
        }
      ]
    connectionStrings: |
      [
        {
          "name": "MysqlCredentials",
          "value": "$(MySQl_ConnectionString)",
          "type": "MySql",
          "slotSetting": false
        }
      ]

Open Source

This task is open source on GitHub. Feedback and contributions are welcome.