Skip to content

fix: fixed ServiceUnavailable errors in Post Deployment Script when executed through Service Principle#2221

Merged
Roopan-Microsoft merged 3 commits into
Azure-Samples:devfrom
Vamshi-Microsoft:psl-fix-ServiceUnavailable
May 13, 2026
Merged

fix: fixed ServiceUnavailable errors in Post Deployment Script when executed through Service Principle#2221
Roopan-Microsoft merged 3 commits into
Azure-Samples:devfrom
Vamshi-Microsoft:psl-fix-ServiceUnavailable

Conversation

@Vamshi-Microsoft
Copy link
Copy Markdown
Contributor

Purpose

This pull request improves the reliability and robustness of the post-deployment setup process for Azure Function Apps. The main changes include simplifying the GitHub Actions workflow by removing redundant retry logic from the workflow YAML and moving enhanced retry and recovery logic into the post_deployment_setup.sh script. The script now includes explicit Function App restarts, better detection and handling of transient host runtime errors, and clearer guidance for manual recovery.

Workflow simplification:

  • The retry and wait logic for running the post-deployment setup script has been removed from .github/workflows/job-post-deployment-setup.yml, so the setup is now attempted only once per workflow run. All retry and recovery logic is now handled within the shell script itself.

Post-deployment script robustness:

  • The script now explicitly restarts the Azure Function App after deployment to ensure the host runtime is in a clean state, addressing issues where role assignments may not be available on the first boot.
  • After restarting, the script waits for the Function App and the Functions host runtime to report as "Running" before proceeding, improving readiness checks.
  • The retry logic for setting the function key has been enhanced: the maximum number of retries has been increased, transient errors (like ServiceUnavailable or InternalServerError) are handled with additional restarts, and host restarts are triggered every 5 failed attempts to clear stuck states.
  • If setting the function key ultimately fails, the script now outputs detailed manual recovery instructions for operators, including Azure Portal and CLI steps.

Does this introduce a breaking change?

  • Yes
  • No

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

Vamshi-Microsoft and others added 3 commits May 12, 2026 15:45
…able errors

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@Roopan-Microsoft Roopan-Microsoft merged commit 79f6852 into Azure-Samples:dev May 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants