Skip to content

fix: reauthenticate before deployment stack retries - #143

Open
RISHABHJAIN27 wants to merge 3 commits into
mainfrom
bug-4209-clean
Open

fix: reauthenticate before deployment stack retries#143
RISHABHJAIN27 wants to merge 3 commits into
mainfrom
bug-4209-clean

Conversation

@RISHABHJAIN27

@RISHABHJAIN27 RISHABHJAIN27 commented Aug 18, 2026

Copy link
Copy Markdown

Fixes #4209

Summary

Long-running deployment stack operations can outlive the Azure authentication context established at the start of the deployment workflow. This change refreshes Azure authentication before deployment stack retry attempts using a fresh GitHub OIDC token.

Changes

Workflow Template

Updated:

  • alz/github/actions/bicep/templates/workflows/cd-template.yaml

Added:

  • AZURE_CLIENT_ID
  • AZURE_TENANT_ID

to the deploy job environment so they can be used by the deployment action during retry operations.

Deployment Action

Updated:

  • alz/github/actions/bicep/templates/actions/bicep-deploy/action.yaml

Added retry-time reauthentication logic that:

  • Validates required OIDC and Azure identity variables are available.
  • Requests a fresh GitHub OIDC token.
  • Reauthenticates using Connect-AzAccount with federated credentials.
  • Continues with the existing Azure context if reauthentication is unavailable or fails.

Validation

  • Verified Azure identity variables are propagated from the deploy workflow to the deployment action.
  • Verified Azure OIDC re-authentication executes successfully during deployment stack retry attempts.
  • Preserved existing retry behavior and retry timing.
    -Existing retry behavior is preserved when re-authentication is not performed.
    `

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refreshes Azure authentication before deployment stack retry attempts to avoid failures when long-running deployments outlive the initial Azure OIDC-authenticated session.

Changes:

  • Propagates AZURE_CLIENT_ID and AZURE_TENANT_ID into the deploy job environment in the CD workflow template.
  • Adds retry-time OIDC token acquisition + Connect-AzAccount reauthentication logic to the bicep deployment composite action.
  • Passes AZURE_CLIENT_ID / AZURE_TENANT_ID through the action’s step environment for use during retries.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
alz/github/actions/bicep/templates/workflows/cd-template.yaml Exposes Azure identity variables to the deploy job environment for downstream action use during retries.
alz/github/actions/bicep/templates/actions/bicep-deploy/action.yaml Reauthenticates to Azure via fresh GitHub OIDC token on deployment stack retry attempts; forwards Azure identity env vars into the action runtime.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread alz/github/actions/bicep/templates/actions/bicep-deploy/action.yaml Outdated
reasonable improvement

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@RISHABHJAIN27 RISHABHJAIN27 changed the title Fix #4209 Reauthenticate before deployment stack retries fix: reauthenticate before deployment stack retries Aug 18, 2026
@RISHABHJAIN27 RISHABHJAIN27 added the PR: Safe to test 🧪 Enables running of End to End Tests label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Safe to test 🧪 Enables running of End to End Tests

Projects

Development

Successfully merging this pull request may close these issues.

3 participants