skip to Main Content

I have 2 deployment slots in Azure Web App: production and staging. I deployed code to Staging slot and then swapped with Production slot without any problem. Now I’m trying to swap back: choose Production slot as source and Staging slot as target, but there is only Stating slot in source slots list, so cannot choose Production slot as source slot. Tried via Azure CLI and got error back ResourceNotFound for Production slot. What can be the problem?

2

Answers


  1. To swap the previous version to Production, you can choose Staging as source and Production as target.
    The two are swapped as a result.

    Let’s say you had v1 in Production and v2 in Staging.
    You swapped Staging to Production.
    Now v2 is in Production and v1 in Staging.
    So doing the same swap again results in v1 in Production and v2 in Staging.

    One thing to note is that Production is technically not a slot, it is the main App Service. That could be why you get a resource not found. Swapping with Production is actually a separate operation from swapping some slot with another slot: https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/swap-slot-with-production.

    Login or Signup to reply.
    • If the Production slot does not appear in the list of source slots and you receive a "ResourceNotFound" error when trying to swap with the Production slot either through Az CLI, the Production slot may have been deleted or it’s no longer accessible in your Web App.

    To check the available slots for a webapp, you can use AzCLI command.

    az webapp deployment slot list --name <webapp> --resource-group <resourcegroupname>
    

    Output:

    enter image description here

    • And sometimes, you can swap between staging and production slots by choosing to target as a production but vice versa is not doable for few app services as detailed in MSDoc.

    And below are my deployment slots which are available under deployments of an App service and you can check the status to see if it is running.

    You can also check the activity log of your app service to find the log history of deployment slots and the relevant information of an App Service/Webapp.

    enter image description here

    If still the issue persists, I suggest you create one new production slot and then deploy your code in it to avoid these conflicts.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search