Skip to content

Conversation

Copy link

Copilot AI commented Jan 23, 2026

The aksarc_jumpstart scripts lacked structured execution status reporting, making it difficult to identify which deployment step failed and troubleshoot issues.

Changes

All four scripts (jumpstart.ps1, jumpstart.sh, deployaksarc.ps1, deployaksarc.sh) now:

  • Track execution state: completed steps, failed step, error context, timestamps
  • Output structured status on both success and failure
  • Maintain proper exit codes for programmatic consumption

PowerShell implementation:

$executionStatus = @{
  Status = "InProgress"
  StartTime = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
  CompletedSteps = @()
  FailedStep = $null
  ErrorMessage = ""
  ExitCode = 0
}

Bash implementation:

print_execution_status() {
    echo "===== EXECUTION STATUS ====="
    echo "Status: $EXECUTION_STATUS"
    echo "Exit Code: $EXIT_CODE"
    echo "Completed Steps: ${COMPLETED_STEPS[*]}"
    # ... failure details if applicable
}

handle_error() {
    EXECUTION_STATUS="Failure"
    FAILED_STEP="$1"
    ERROR_MESSAGE="$2"
    print_execution_status
    exit "$3"
}

Example Output

On failure:

===== EXECUTION STATUS =====
Status: Failure
Failed Step: CreateVirtualMachine
Error Message: Failed to create virtual machine 'jumpstartVM'. Azure CLI command failed with exit code 1
Exit Code: 1
Completed Steps: CreateResourceGroup, CreateVirtualNetwork
Start Time: 2026-01-23 01:05:00
End Time: 2026-01-23 01:10:00
============================

On success:

===== EXECUTION STATUS =====
Status: Success
Exit Code: 0
Completed Steps: CreateResourceGroup, CreateVirtualNetwork, CreateVirtualMachine, AssignManagedIdentity, AssignContributorRole, EnableNestedVirtualization, ExecuteScript_initializedisk.ps1, ExecuteScript_0.ps1, ExecuteScript_1.ps1, ExecuteScript_deployazcli.ps1, ExecuteScript_deploymoc.ps1
Start Time: 2026-01-23 01:05:00
End Time: 2026-01-23 01:25:00
============================

Implementation Details

  • Bash scripts: Centralized error handling via handle_error() function
  • PowerShell scripts: Hashtable-based state tracking with inline error handling
  • Error handling: Added missing checks for role assignment and VM update operations
  • Code quality: Reduced duplication by extracting $scriptBaseName variable in deployaksarc.ps1

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 23, 2026 01:09
…messages

Co-authored-by: madhanrm <20309044+madhanrm@users.noreply.github.com>
…uplication

Co-authored-by: madhanrm <20309044+madhanrm@users.noreply.github.com>
Copilot AI changed the title [WIP] Update aksarc_jumpstart to return execution status and error message Add execution status and error reporting to aksarc_jumpstart scripts Jan 23, 2026
Copilot AI requested a review from madhanrm January 23, 2026 01:13
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