You are configuring a release pipeline in Azure Pipelines that deploys a web app to Azure App Service. The pipeline uses a stage with a deployment job. You need to ensure that the deployment uses a specific deployment slot named 'staging' and then swaps it with the production slot after successful deployment. Which task should you use?
This combination first deploys the app to the staging slot using AzureRmWebAppDeployment@4 with the SlotName set to 'staging'. Then, AzureAppServiceManage@0 with the Swap Slots action swaps the staging slot with the production slot. This meets the requirement of deploying to a specific slot and then swapping. It is a common pattern for zero-downtime deployments.
Why this answer
The correct approach is to use two tasks: first, deploy to the staging slot using AzureRmWebAppDeployment@4 with the slot name specified; second, use AzureAppServiceManage@0 to swap the staging slot with production. This ensures the new version is deployed to staging, tested if desired, and then swapped into production. The other options either miss the deployment step or the swap step.
Exam trap
The trap here is assuming that the deployment task can also perform a slot swap, when in fact a separate task is required.