Azure CLI error Swapping Slots

Schenz, Brandon 11 Reputation points
2021-05-26T18:55:07.077+00:00

I have an Azure App Service that is running under linux, and at times when I issue a CLI command in my GitHub action pipelines for CI/CD I get the following error that is not very helpful:
"ERROR: Operation returned an invalid status 'Expectation Failed'
INFO: Command ran in 1387.892 seconds (init: 0.156, invoke: 1387.736)"

What can I look at to get more details on why these failures occur? Many times re-running the pipeline works, but I'd rather know why the failures happen in the first place (especially since it takes 23 minutes on average to get the failure, and cannot re-try until the failure comes back)

here is the command:
az webapp deployment slot swap \
--name {APP_NAME} \
--resource-group {RG} \
--slot blue \
--target-slot production \
--verbose

and --verbose does not really help that much give me a better understanding of what is going on...

and it's almost always in centralus, I also deploy to eastus2 and those tend not to have any problems.

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

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 21,006 Reputation points
    2021-05-27T10:36:45.577+00:00

    Thanks for asking question! Could you please confirm on App Service plan you are using? As the app must be running in the Standard, Premium, or Isolated tier in order for you to enable multiple deployment slots and each App Service plan tier supports a different number of deployment slots. To find out the number of slots your app's tier supports, see App Service limits.

    If the swap operation takes a long time to complete, you can get information on the swap operation in the activity log. On your App's resource page in the portal, in the left pane, select Activity log.

    You can create slot by using below sample command from Azure CLI.

    az webapp deployment slot create --name MyWebapp --resource-group MyResourceGroup --slot staging

    after creating slot you can swap using below sample command:

    az webapp deployment slot swap -g MyResourceGroup -n MyUniqueApp --slot staging --target-slot production

    Further you can use App Service Diagnostics feature which helps you to troubleshoot your app with no configuration required. When you run into issues with your app, App Service Diagnostics points out what’s wrong and guide you to the right information to more easily resolving the issues.

    Go to Azure Portal > Select your App Service > on left side of menu click on Diagnose and solve problems > select configurations and Management > select check swap operations from left menu.

    You may also refer to below links might be helpful:
    https://learn.microsoft.com/en-us/azure/app-service/deploy-staging-slots#troubleshoot-swaps

    Please let us know if issue remains.