Skip to content

Add debug flag support to azd commands in deployment workflows#358

Merged
ianjensenisme merged 6 commits intomainfrom
hadwa/add_debug_flag
Apr 20, 2026
Merged

Add debug flag support to azd commands in deployment workflows#358
ianjensenisme merged 6 commits intomainfrom
hadwa/add_debug_flag

Conversation

@HadwaAbdelhalem
Copy link
Copy Markdown
Collaborator

Description
This PR adds GitHub's native debug logging support to Azure Developer CLI (azd) commands in the deployment workflows, enabling verbose output for troubleshooting infrastructure provisioning and teardown operations.

Changes Made
azure-dev.yml (CI-Deploy workflow)

Added inline debug flag detection using DEBUG_FLAG variable pattern for azd provision command
Added inline debug flag detection using DEBUG_FLAG variable pattern for azd down command
Simplified implementation with no external dependencies
azure-dev-down.yml (CI Destroy Resources workflow)

Added inline debug flag detection using DEBUG_FLAG variable pattern for azd provision --preview command
Added inline debug flag detection using DEBUG_FLAG variable pattern for azd down command
Simplified implementation with no external dependencies
When debug logging is enabled, the --debug flag is passed to azd commands, providing:

Detailed infrastructure provisioning steps
Terraform/Bicep plan and apply output
Resource creation/deletion logs
Hook execution details
Error stack traces with full context
How to enable debug mode
To see verbose output from azd commands:

Click "Re-run jobs" on a workflow run
Check "Enable debug logging"
Click "Re-run jobs"
GitHub automatically sets the environment variables ACTIONS_STEP_DEBUG, ACTIONS_RUNNER_DEBUG, and RUNNER_DEBUG, which the workflow detects to add the --debug flag to azd commands.

Technical approach
DEBUG_FLAG variable pattern:

Detect if debug logging is enabled and set DEBUG_FLAG accordingly

DEBUG_FLAG=""
if [ "$ACTIONS_STEP_DEBUG" = "true" ] || [ "$ACTIONS_RUNNER_DEBUG" = "true" ] || [ "$RUNNER_DEBUG" = "1" ]; then
DEBUG_FLAG="--debug"
fi
azd provision --no-prompt $DEBUG_FLAG
azd down --no-prompt --force --purge $DEBUG_FLAG
This approach uses a simple variable to conditionally append the --debug flag, eliminating command duplication in if/else branches.

Benefits
✅ Simple implementation: Inline logic with no external scripts
✅ No duplication: Single azd command invocation with conditional DEBUG_FLAG
✅ Easy to understand: All logic visible directly in workflow files
✅ Consistent behavior: Same pattern across all azd command invocations
✅ Maintainable: Straightforward conditional logic

Modified Files
.github/workflows/azure-dev.yml - Added DEBUG_FLAG pattern for azd provision and azd down
.github/workflows/azure-dev-down.yml - Added DEBUG_FLAG pattern for azd provision and azd down
Related Issue(s)
Links to related issues will be added by the system

Original prompt
Fixes [Bug] Linter Workflow Outputs No Error Details #254

@HadwaAbdelhalem HadwaAbdelhalem requested a review from a team as a code owner January 16, 2026 00:29
Copilot AI review requested due to automatic review settings January 16, 2026 00:29
@HadwaAbdelhalem HadwaAbdelhalem self-assigned this Jan 16, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds GitHub's native debug logging support to Azure Developer CLI (azd) commands in deployment workflows, enabling verbose troubleshooting output for infrastructure operations without requiring workflow file modifications. The implementation uses a simple inline bash conditional to detect GitHub's debug environment variables and append the --debug flag to azd commands.

Changes:

  • Added inline debug flag detection to azd provision and azd down commands in azure-dev.yml
  • Added inline debug flag detection to azd provision --preview and azd down commands in azure-dev-down.yml
  • Minor whitespace cleanup (removed trailing spaces)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
.github/workflows/azure-dev.yml Added DEBUG_FLAG conditional logic for azd provision and azd down commands to support debug mode when GitHub debug logging is enabled
.github/workflows/azure-dev-down.yml Added DEBUG_FLAG conditional logic for azd provision --preview and azd down commands to support debug mode when GitHub debug logging is enabled

Comment thread .github/workflows/azure-dev.yml
Comment thread .github/workflows/azure-dev.yml
Comment thread .github/workflows/azure-dev-down.yml
Comment thread .github/workflows/azure-dev-down.yml
Comment thread .github/workflows/azure-dev-down.yml
devorekristen
devorekristen previously approved these changes Jan 16, 2026
ianjensenisme
ianjensenisme previously approved these changes Apr 10, 2026
Copy link
Copy Markdown
Contributor

@ianjensenisme ianjensenisme left a comment

Choose a reason for hiding this comment

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

I've never been happier to say this on a review: LGTM!

@ianjensenisme ianjensenisme merged commit 034531f into main Apr 20, 2026
8 of 11 checks passed
@ianjensenisme ianjensenisme deleted the hadwa/add_debug_flag branch April 20, 2026 16:07
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.

4 participants