Azure Functions: Deploying to Staging Slot Restarts Production Slot

Viewed 795

We have an Azure Function v3 instance on a Consumption plan which includes a staging slot to reduce downtime during deployments.

Our deployment process is:

  • deploy the code to the staging slot
  • start the staging slot
  • swap the staging slot with the production one
  • stop the staging slot

We are using Azure Pipelines to deploy the code, .NET Core 3.1, to the staging slot; here is the YAML definition for this step:

- task: AzureFunctionApp@1
  displayName: 'Deploy to Staging Slot'
  inputs:
    azureSubscription: '****'
    appType: functionApp
    appName: '****'
    package: '$(System.ArtifactsDirectory)/Build.zip'
    deployToSlotOrASE: true
    slotName: 'staging'
    resourceGroupName: '****'

I have disabled all the steps after this one and run ONLY this step. Once the step completes in Azure Pipelines, the main app, i.e. the production slot, restarts and I start receiving 503 Service Unavailable for about 5 seconds followed by a cold start.

What I don't understand is how deploying the code to the staging slot without swapping can cause a restart on the production slot.

I have made sure that auto-swap is disabled, so that's not the case.

How can it be explained and fixed? We are trying to remove the 503 entirely and have zero-downtime deployments.

Update: I have already tried adding WEBSITE_ADD_SITENAME_BINDINGS_IN_APPHOST_CONFIG to both staging and production slot. Didn't make a difference.

0 Answers
Related