[Appservice] Fix #31394: az functionapp deployment source config-zip: never ending loop on flex function app health check#33388
Conversation
Adds missing tries count Breaks out if IP restriction in place
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
az functionapp deployment source config-zip: never ending loop on flex function app health check
There was a problem hiding this comment.
Pull request overview
Fixes a hang in the App Service module’s post-deployment health check for Flex Function Apps invoked by az functionapp deployment source config-zip, by ensuring the retry loop terminates and by short-circuiting when the health check is blocked by IP restrictions.
Changes:
- Increment
num_trialsfor non-2xx health-check responses to prevent an infinite retry loop. - Exit the health-check loop early when a 403 response indicates IP-based access restriction.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| break | ||
| if response.status_code == 403 and response.reason == 'Ip Forbidden': | ||
| logger.warning("Failed to check health due to IP restriction") | ||
| break |
| if response.status_code == 403 and response.reason == 'Ip Forbidden': | ||
| logger.warning("Failed to check health due to IP restriction") | ||
| break | ||
| num_trials = num_trials + 1 |
Related command
az functionapp deployment source config-zip
Description
The
check_flex_app_after_deploymentfunction called after a deployment had a never ending re-try loop for non-2xx response status codes. This PR adds the missingnum_trialsincrement. It also breaks out of the health check when an IP restriction is found preventing the health check to complete from the client.Testing Guide
An existing function app with a default network rule of Deny has no access from the client to the app. Run the deployment command:
az functionapp deployment source config-zip \ --resource-group MyResourceGroup \ --name MyUniqueAppName \ --src funcapp.zipBefore it would hang forever, but now transient errors are handled and retries are done up the the limit.
History Notes
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.