question

SchenzBrandon-8744 avatar image
2 Votes"
SchenzBrandon-8744 asked Grant-5068 commented

Azure CLI error Swapping Slots

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-webapps
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I'm having the same issue when attempting to initiate a swap a linux app. Not using azure cli, but using AZ module functions (Switch-AzWebAppSlot), and have attempting to trigger the swap in the portal to no avail.

The function doesn't return for 20-30 minutes, and the slot activity log shows the failure and that the slot didn't respond to the 'http ping." Would love to know if you manage to solve this.

0 Votes 0 ·

1 Answer

SnehaAgrawal-MSFT avatar image
0 Votes"
SnehaAgrawal-MSFT answered NehaAnilRBEIPACCSW2-8102 commented

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://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots#troubleshoot-swaps

Please let us know if issue remains.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I do see errors like the following, but they are not repeatable. I run pipeline now, get failures. Re-Run pipeline and swap operation completes as expected.

From Diagnostics:
"Swap failed. Details: Cannot swap site slots for site '{SITENAME}' because the '{SLOT}' slot did not respond to http ping."

From Activity Log, this is part that fails:
properties.state Update System Stopped Running

0 Votes 0 ·

This is a java app running in a Linux App Service container (P2V2) and checked the docker logs for application issues, and see nothing wrong with those either

0 Votes 0 ·

@SchenzBrandon-8744 @SnehaAgrawal-MSFT Is this issue resolved? I'm facing the exact same issue





·

0 Votes 0 ·