Azure App Service Manage task

Azure Pipelines

Use this task to start, stop, restart, slot swap, Swap with Preview, install site extensions, or enable continuous monitoring for an Azure App Service.

YAML snippet

# Azure App Service manage
# Start, stop, restart, slot swap, slot delete, install site extensions or enable continuous monitoring for an Azure App Service
- task: AzureAppServiceManage@0
  inputs:
    azureSubscription: 
    #action: 'Swap Slots' # Optional. Options: Swap Slots, Start Swap With Preview, Complete Swap, Cancel Swap, Start Azure App Service, Stop Azure App Service, Restart Azure App Service, Delete Slot, Install Extensions, Enable Continuous Monitoring, Start all continuous webjobs, Stop all continuous webjobs
    webAppName: 
    #specifySlotOrASE: false # Optional
    #resourceGroupName: # Required when action == Swap Slots || Action == Delete Slot || SpecifySlot == True
    #sourceSlot: # Required when action == Swap Slots
    #swapWithProduction: true # Optional
    #targetSlot: # Required when action == Swap Slots && SwapWithProduction == False
    #preserveVnet: false # Optional
    #slot: 'production' # Required when action == Delete Slot || SpecifySlot == True
    #extensionsList: # Required when action == Install Extensions
    #outputVariable: # Optional
    #appInsightsResourceGroupName: # Required when action == Enable Continuous Monitoring
    #applicationInsightsResourceName: # Required when action == Enable Continuous Monitoring
    #applicationInsightsWebTestName: # Optional

Arguments

Argument Description
ConnectedServiceName
Azure subscription
(Required) Select the Azure Resource Manager subscription
Argument alias: azureSubscription
Action
Action
(Optional) Action to be performed on the App Service. You can Start, Stop, Restart, Slot swap, Start Swap with Preview, Complete Swap with preview, Cancel Swap with preview, Install site extensions or enable Continuous Monitoring for an Azure App Service
Default value: Swap Slots
WebAppName
App Service name
(Required) Enter or select the name of an existing Azure App Service
SpecifySlot
Specify Slot or App Service Environment
(Optional) undefined
ResourceGroupName
Resource group
(Required) Enter or Select the Azure Resource Group that contains the Azure App Service specified above
SourceSlot
Source Slot
(Required) Used as source slot when action == Swap Slots. The swap action directs destination slot's traffic to the source slot.
SwapWithProduction
Swap with Production
(Optional) Select the option to swap the traffic of source slot with production. If this option is not selected, then you will have to provide source and target slot names.
Default value: true
TargetSlot
Target Slot
(Required) Used as destination slot when action == Swap Slots. The swap action directs destination slot's traffic to the source slot.
PreserveVnet
Preserve Vnet
(Optional) The swap action would overwrite the destination slot's network configuration with the source
Default value: false
Slot
Slot
(Required)
Default value: production
ExtensionsList
Install Extensions
(Required) Site Extensions run on Microsoft Azure App Service. You can install set of tools as site extension and better manage your Azure App Service. The App Service will be restarted to make sure latest changes take effect.
OutputVariable
Output variable
(Optional) Provide the variable name for the local installation path for the selected extension.This field is now deprecated and would be removed. Use LocalPathsForInstalledExtensions variable from Output Variables section in subsequent tasks.
AppInsightsResourceGroupName
Resource Group name for Application Insights
(Required) Enter or Select resource group where your application insights resource is available
ApplicationInsightsResourceName
Application Insights resource name
(Required) Select Application Insights resource where continuous monitoring data will be recorded. If your application insights resource is not listed here and you want to create a new resource, click on [+New] button. Once the resource is created on Azure portal, come back here and click on refresh button.
ApplicationInsightsWebTestName
Application Insights web test name
(Optional) Enter Application Insights Web Test name to be created or updated. If not provided, the default test name will be used.

What happens during a swap

When you swap two slots (usually from a staging slot into the production slot), make sure that the production slot is always the target slot. This way, the swap operation doesn't affect your production app.

Also at any point of the swap (or swap with preview) operation, all work of initializing the swapped apps happens on the source slot. The target slot remains online while the source slot is being prepared and warmed up, regardless of where the swap succeeds or fails. Please refer to Set up staging environments in Azure App Service for more details.

Open source

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