1
votes

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.

The slot feature was not recommended for a long time by the Azure Functions team. Then they suddenly added it without preview. I would not use it.Farrukh Normuradov
I also remember seeing someone else here struggling with similar issue (or probably it was the same).Kashyap
Here it is.Kashyap
Perhaps when you deploy, some non-slot-specific app setting may trigger certain changes, and these changes are specific to non-slot app setting. These app setting may trigger the restart of the production slot, you may need to check your app settings, it is best to check the log to get more detailed information.Frank Gong