I'm encountering 502s intermittently when I execute the az web deploy
command using Azure CLI in my local machine. The main concern is that a zip file, which is deployed to /home/site/wwwroot
, isn't exploding properly. However, after multiple attempts it works and explodes the zip content properly. But I wonder why is this so inconsistent.
I tried to execute the same az
command by adding parameters --timeout
& --debug
, but I have not clue why the error is happening intermittently, and the zip file not exploding properly under wwwroot
in Windows App Service.
I'm encountering 502s intermittently when I execute the az web deploy
command using Azure CLI in my local machine. The main concern is that a zip file, which is deployed to /home/site/wwwroot
, isn't exploding properly. However, after multiple attempts it works and explodes the zip content properly. But I wonder why is this so inconsistent.
I tried to execute the same az
command by adding parameters --timeout
& --debug
, but I have not clue why the error is happening intermittently, and the zip file not exploding properly under wwwroot
in Windows App Service.
A 502 error occurs when the App Service is temporarily unavailable or not responding. This can be caused by Azure delays, network issues, or deployment conflicts.
When deploying a ZIP package, Azure automatically extracts it to /home/site/wwwroot
. If it needs multiple attempts, the cause could be Incomplete or failed deployments or Files being locked during extraction.
Make Sure ZIP Deployment Mode is Correct check WEBSITE_RUN_FROM_PACKAGE is set to 0 or 1 by running below command.
az webapp config appsettings set --name <app-name> --resource-group <resource-group> --settings WEBSITE_RUN_FROM_PACKAGE=0
If it is set to 1 Azure won’t extract the ZIP, which may be causing the issue.
Stop the Azure Web app before deployment, this ensures there are no locked files that might prevent ZIP extraction. And start the app after deployment.
az webapp stop --name <app-name> --resource-group <resource-group>
az webapp deploy --resource-group <resource-group> --name <app-name> --src-path <zip-file-path>
az webapp start --name <app-name> --resource-group <resource-group>
Azure Output: