Skip to content

Latest commit

 

History

History
289 lines (238 loc) · 8.27 KB

azure-app-service-settings-v1.md

File metadata and controls

289 lines (238 loc) · 8.27 KB
title description ms.date monikerRange
AzureAppServiceSettings@1 - Azure App Service Settings v1 task
Update/Add App settings an Azure Web App for Linux or Windows.
06/11/2024
>=azure-pipelines-2020

AzureAppServiceSettings@1 - Azure App Service Settings v1 task

:::moniker range=">=azure-pipelines-2020"

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

:::moniker-end

Syntax

:::moniker range=">=azure-pipelines-2020"

# 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.

:::moniker-end

Inputs

:::moniker range=">=azure-pipelines-2020"

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

Selects the Azure Resource Manager subscription.


:::moniker-end

:::moniker range=">=azure-pipelines-2020"

appName - App Service name
string. Required.

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


:::moniker-end

:::moniker range=">=azure-pipelines-2020"

resourceGroupName - Resource group
string. Required.

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


:::moniker-end

:::moniker range=">=azure-pipelines-2020"

slotName - Slot
string. Default value: production.

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


:::moniker-end

:::moniker range=">=azure-pipelines-2020"

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
   }
]

:::moniker-end

:::moniker range=">=azure-pipelines-2020"

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
   }
]

:::moniker-end

:::moniker range=">=azure-pipelines-2020"

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
   }
]

:::moniker-end

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

:::moniker range=">=azure-pipelines-2020"

None.

:::moniker-end

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

:::moniker range=">=azure-pipelines-2020"

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

:::moniker-end