how to enable swap slot to stop after deployment in azure pipeline

Darragh Martin 86 Reputation points
2023-01-19T15:57:55.0266667+00:00

ive set up a pipeline in azure that allows me to use a swapslot when deploying but I would like to stop the swapslot after deployment so it does not consume resources. It would also mean I would have to start it before doing a deployment. Is there way of going about this in the pipeline or in the releases? I have yet to come up with a solution

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,965 questions
{count} votes

Accepted answer
  1. Abdul Sajid Mohammed 470 Reputation points Microsoft Employee
    2023-01-19T19:59:36.0133333+00:00

    Hello Darragh,

    Based on my understanding your requirement is to Delay/Hold your deployment slots swap until a manual validation is performed, and then trigger a swap after successful testing on staging slot.

    After your deployment stage in your YML file I would add an additional jobs/step such as below:

     

    - job: waitForValidation
      dependsOn: Deployment to your Environment
      displayName: 'Wait for approval or validation to swap slots'
      timeoutInMinutes: 35780 
      pool: server
      steps:
      - task: ManualValidation@0
        displayName: 'Wait for approval to swap slots'
        inputs:
          notifyUsers: 
              ******@xyz.com 
    
    - job: swapSlot
      dependsOn: waitforValidation
      steps:
      - task: AzureAppServiceManager@0
        inputs:
          azureSubscription: 'Your Subscription Information'
          Action: 'Swap Slots'
          WebAppName: 'your app name'
          ResourceGroupName: 'your resourcegroup name'
          SourceSlot: 'slot-1'
    

     

    Hope this helps to meet your requirements.

    Thanks.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Darragh Martin 86 Reputation points
    2023-01-24T13:59:55.4633333+00:00

    I didn't make any adjustments to my yml file as I saw there was no need to do so. I instead added some additional tasks to my pipeline setup by using the Azure App service manage to incorporate the start and stop methods and worked perfectly but I appreciate the help from you all.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.