az-bootstrap icon indicating copy to clipboard operation
az-bootstrap copied to clipboard

Add interactive mode and SkipConfirmation support to Add-AzBootstrapEnvironment

Open Copilot opened this issue 11 months ago • 0 comments

This PR aligns Add-AzBootstrapEnvironment with Invoke-AzBootstrap by adding interactive mode support, SkipConfirmation parameter, and intelligent defaults from existing project configuration.

Key Changes

Interactive Mode Support

  • Automatic detection: Function enters interactive mode when required parameters are missing
  • Intelligent defaults: Reads existing .azbootstrap.jsonc configuration to suggest appropriate defaults based on project patterns
  • User-friendly prompts: Guides users through parameter entry with contextual help

SkipConfirmation Parameter

  • Added -SkipConfirmation switch parameter to bypass confirmation prompts
  • Enables automation scenarios while maintaining safety for manual use
  • Consistent with Invoke-AzBootstrap behavior

Configuration Integration

  • Local config reading: New Get-AzBootstrapLocalConfig function reads repository .azbootstrap.jsonc
  • Project pattern detection: Automatically derives naming conventions from existing environments
  • Global config integration: Respects global location defaults from ~/.azbootstrap-globals.jsonc

Example Usage

Interactive Mode (new)

# Prompts for missing parameters with intelligent defaults
Add-AzBootstrapEnvironment -EnvironmentName "prod"

Non-Interactive Mode with Confirmation (existing, enhanced)

# Shows summary and prompts for confirmation
Add-AzBootstrapEnvironment -EnvironmentName "test" -ResourceGroupName "rg-myapp-test" -Location "eastus" -PlanManagedIdentityName "mi-myapp-test-plan"

Automated Mode (new)

# Bypasses confirmation for automation
Add-AzBootstrapEnvironment -EnvironmentName "test" -ResourceGroupName "rg-myapp-test" -Location "eastus" -PlanManagedIdentityName "mi-myapp-test-plan" -SkipConfirmation

Implementation Details

New Functions

  • Get-AzBootstrapLocalConfig: Reads and parses repository .azbootstrap.jsonc files
  • Start-AzBootstrapEnvironmentInteractiveMode: Handles interactive parameter collection with defaults

Updated Functions

  • Add-AzBootstrapEnvironment: Enhanced with interactive mode, confirmation prompts, and configuration integration
  • Made ResourceGroupName, Location, and PlanManagedIdentityName optional to enable interactive mode

Testing

  • Added comprehensive test coverage (10 new tests)
  • All existing functionality preserved (31 total tests passing)
  • Tests cover both interactive detection and non-interactive modes

Documentation

  • Updated README.md with new usage examples
  • Enhanced DESIGN.md with architectural details
  • Examples show both interactive and automated workflows

Backward Compatibility

  • Existing scripts continue to work unchanged
  • All parameter defaults and behaviors preserved
  • Only new functionality added, no breaking changes

Fixes #51.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar May 31 '25 05:05 Copilot