Az Function Consumption plan reverts production slot few minutes after swapping slots (Premium plan doesn't)?

Andrew Connell 41 Reputation points MVP
2021-05-04T12:12:32.397+00:00

I've got an Azure Function setup to deploy (via GitHub actions for CD) to my staging slot... works as expected. Once I've ensured everything looks good, I swap the slots using the Azure CLI. Again, everything looks good and is running as expected in the production slot.

swap-deployment-slots:  
  name: Swap Azure Function deployment slots  
  runs-on: ubuntu-latest  
  needs: update-prod-slot-settings  
  steps:  
    ######################################################################  
    # login to Azure CLI via service principal  
    ######################################################################  
    - name: Login to Azure  
      run: az login --service-principal --tenant $AZURE_BOT_TENANT_ID --username $AZURE_BOT_CLIENT_ID --password $AZURE_BOT_CLIENT_SECRET  
      env:  
        AZURE_BOT_TENANT_ID: ${<!-- -->{ env.AZURE_BOT_TENANT_ID }}  
        AZURE_BOT_CLIENT_ID: ${<!-- -->{ env.AZURE_BOT_CLIENT_ID }}  
        AZURE_BOT_CLIENT_SECRET: ${<!-- -->{ secrets.AZURE_BOT_CLIENT_SECRET }}  
  
    ######################################################################  
    # swap deployment slots  
    ######################################################################  
    - name: Swap staging & production deployment slot  
      run: |  
        az functionapp deployment slot swap --resource-group $AZURE_FUNCTION_APP_RESOURCE_GROUP --name $AZURE_FUNCTION_APP_NAME --slot $AZURE_FUNCTION_APP_STAGING_SLOT --target-slot $AZURE_FUNCTION_APP_PRODUCTION_SLOT  
      env:  
        AZURE_FUNCTION_APP_RESOURCE_GROUP: ${<!-- -->{ env.AZURE_FUNCTION_APP_RESOURCE_GROUP }}  
        AZURE_FUNCTION_APP_NAME: ${<!-- -->{ env.AZURE_FUNCTION_APP_NAME }}  
        AZURE_FUNCTION_APP_STAGING_SLOT: ${<!-- -->{ env.AZURE_FUNCTION_APP_STAGING_DEPLOYMENT_SLOT }}  
        AZURE_FUNCTION_APP_PRODUCTION_SLOT: production  

*Ignore the HTML comments in the above snippet... something with question editor is generating those... this does work... *

Just to verify, when I inspect the function in the portal ([function app] > Functions > [select function] > Code + Test), I can see the contents of the function.json file.

93527-image.png

However, after a few minutes, with no changes applied, all the files disappear from the production deployment slot. Going back to the same Code + Test interface, the file selector is empty:

93606-image.png

This only happens when I'm testing using an Azure Function App on the consumption plan... this doesn't happen when I try this using the Premium plan. From my research, I can't find anything that would trigger this auto-rollback.

  • is this expected?
  • am I missing something?
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
2,618 questions
No comments
1 vote

1 answer

Sort by: Most helpful
  1. Andrew Stegmaier 6 Reputation points
    2021-05-04T15:28:53.873+00:00

    This is not a complete answer - just a report of the same thing and a suggestion to try the Windows Consumption Plan instead. The commenting system seemed to be down when I posted this

    I think I might be hitting the same issue.

    Here's what I'm doing:

    • create a new linux consumption plan on the azure portal
    • create a slot called "staging"
    • deploy a test function to the staging slot, and confirm that it's working with postman.
    • use the azure portal to trigger a swap with production (this is different from what @Andrew Connell did but it appears to yield the same result).
    • the portal indicates that the swap succeeded, and if you view the logs in Deployment Slots > Logs, everything I can see there shows "Success", too.

    When I try out the test function for the production slot, I get 404 errors, and I don't see my test function in the azure portal in the production slot. The function is still in the "staging" slot as if the swap never occurred.

    When I try the same thing with a windows consumption plan, everything works as expected.

    In the docs, staging slots for Linux Consumption Plan functions are listed as "Preview" (not GA) status: https://learn.microsoft.com/en-us/azure/azure-functions/functions-deployment-slots#support-levels

    I wonder if this is a bug associated with the preview? I'm happy to file it somewhere and provide more details/logs.