Rediger

Del via


AzureAppServiceSettings@1 - Azure App Service Settings v1 task

Updates or adds app service settings in an Azure Web App for Linux or Windows.

Syntax

# Azure App Service Settings v1
# Update/Add App settings an Azure Web App for Linux or Windows.
- task: AzureAppServiceSettings@1
  inputs:
    azureSubscription: # string. Alias: ConnectedServiceName. Required. Azure subscription. 
    appName: # string. Required. App Service name. 
    resourceGroupName: # string. Required. Resource group. 
    #slotName: 'production' # string. Slot. Default: production.
  # Application and Configuration Settings
    #appSettings: # string. App settings. 
    #generalSettings: # string. General settings. 
    #connectionStrings: # string. Connection Strings.

Inputs

azureSubscription - Azure subscription
Input alias: ConnectedServiceName. string. Required.

Selects the Azure Resource Manager subscription.


appName - App Service name
string. Required.

Enters or selects the name of an existing Azure App Service.


resourceGroupName - Resource group
string. Required.

Enters or selects the Azure Resource Group that contains the Azure App Service specified above.


slotName - Slot
string. Default value: production.

Enters or selects an existing slot. If you don't select a slot, changes are made to production.


appSettings - App settings
string.

Application settings in JSON syntax. Enclose values containing spaces in double quotes. For more information, see Configure app settings.

The following is an example of the JSON syntax:

[
   {
    "name": "key1",
    "value": "valueabcd",
    "slotSetting": false
   },
   {
    "name": "key2",
    "value": "valueefgh",
    "slotSetting": true
   }
]

generalSettings - General settings
string.

General settings in JSON syntax. Enclose values containing spaces in double quotes. For a list of the available properties, see the App Service SiteConfig object documentation. For more information, see Configure general settings.

The following is an example of the JSON syntax:

[
   {
    "alwaysOn": true,
    "webSocketsEnabled": false
   }
]

connectionStrings - Connection Strings
string.

Connection strings in JSON syntax. Enclose values containing spaces in double quotes. For more information, see Configure connection strings.

The following is an example of the JSON syntax:

[
   {
    "name": "key1",
    "value": "valueabcd",
    "type": "MySql",
    "slotSetting": false
   },
   {
    "name": "key2",
    "value": "valueefgh",
    "type": "Custom",
    "slotSetting": true
   }
]

Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

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.

Examples

The following example YAML snippet deploys a web application to an Azure Web App service running on windows.


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: |
      [
        {
          "alwaysOn": true,
          "webSocketsEnabled": false
        }
      ]
    connectionStrings: |
      [
        {
          "name": "MysqlCredentials",
          "value": "$(MySQl_ConnectionString)",
          "type": "MySql",
          "slotSetting": false
        }
      ]

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.104.1 or greater
Task category Deploy