Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 3, 2025

Pull Request

Issue

Issue #, if available: Fixes #493

Description

Description of changes:

The powershell-yaml module is required for YAML config file parsing (used in Get-ALZConfig.ps1) but was not validated in pre-deployment checks. This adds a conditional check in Test-Tooling.ps1 that only runs when YAML files are provided as input configuration files.

Changes to Test-Tooling.ps1:

  • Added new optional parameter $checkYamlModule to control whether the YAML module check is performed
  • Validates module installation using Get-Module -ListAvailable
  • Reports success with version info when present
  • Reports failure with installation command when missing
  • Blocks deployment when absent (sets $hasFailure flag)

Changes to Deploy-Accelerator.ps1:

  • Added consolidated logic to detect YAML files (.yml or .yaml extensions) in input configuration file paths
  • Checks both $inputConfigFilePaths parameter and ALZ_input_config_path environment variable
  • Includes path validation and error handling for edge cases
  • Passes $hasYamlFiles flag to Test-Tooling via the -checkYamlModule parameter
  • Refactored to eliminate code duplication in YAML file detection logic
  • Fixed code formatting issues (trailing whitespace)

The check follows the existing pattern used for Git, Azure CLI, and ALZ module validation. It only executes when YAML files are detected in the inputs, ensuring the module is not required when users provide only JSON files.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.

Original prompt

This section details on the original issue you should resolve

<issue_title>Feature Request: Add support for checking for powershell-YAML module installed in Test-Tooling.ps1</issue_title>
<issue_description>### Is there an existing issue for this?

  • I have searched the existing issues

Infrastructure as Code Type? (Required)

not relevant

Starter Module? (Required)

not relevant

Use Case (Required)

In https://github.com/Azure/ALZ-PowerShell-Module/blob/main/src/ALZ/Private/Tools/Test-Tooling.ps1 we do not check for the installation of powershell-YAML powershell module that is required by this module, but we should.

Proposed Solution (Required)

add check for powershell-yaml module to https://github.com/Azure/ALZ-PowerShell-Module/blob/main/src/ALZ/Private/Tools/Test-Tooling.ps1

Important Factoids (Optional)

No response

References (Optional)

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


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

Co-authored-by: jtracey93 <41163455+jtracey93@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for checking powershell-YAML module in Test-Tooling.ps1 Add powershell-yaml module check to Test-Tooling.ps1 Dec 3, 2025
Copilot AI requested a review from jtracey93 December 3, 2025 10:27
@jtracey93
Copy link
Collaborator

Thanks @copilot. Can we make this check only happen from the main Deploy-Accelerator function if the customer has provided .yaml files as inputs. If they have provided .json files this isn't needed

Co-authored-by: jtracey93 <41163455+jtracey93@users.noreply.github.com>
@jtracey93 jtracey93 marked this pull request as ready for review December 3, 2025 13:38
@jtracey93 jtracey93 changed the title Add powershell-yaml module check to Test-Tooling.ps1 feat: Add powershell-yaml module check to Test-Tooling.ps1 Dec 3, 2025
Co-authored-by: jtracey93 <41163455+jtracey93@users.noreply.github.com>
@jtracey93
Copy link
Collaborator

@jaredfholgate thoughts?

Copy link
Contributor Author

Copilot AI commented Dec 3, 2025

Thanks @copilot. Can we make this check only happen from the main Deploy-Accelerator function if the customer has provided .yaml files as inputs. If they have provided .json files this isn't needed

Updated the implementation to make the YAML module check conditional. It now only runs when YAML files (.yml or .yaml extensions) are detected in the input configuration file paths. The check supports both direct file path parameters and the ALZ_input_config_path environment variable. Changes made in commit f05eb11.

Copilot AI changed the title feat: Add powershell-yaml module check to Test-Tooling.ps1 Add conditional powershell-yaml module check to Test-Tooling.ps1 Dec 3, 2025
Copy link
Member

@jaredfholgate jaredfholgate left a comment

Choose a reason for hiding this comment

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

Just some code quality stuff

Co-authored-by: jaredfholgate <1612200+jaredfholgate@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs: Author Feedback 👂 Needs the author to provide feedback label Dec 3, 2025
Copilot AI requested a review from jaredfholgate December 3, 2025 14:06
jaredfholgate
jaredfholgate previously approved these changes Dec 3, 2025
Copy link
Member

@jaredfholgate jaredfholgate left a comment

Choose a reason for hiding this comment

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

LGTM

@jaredfholgate jaredfholgate changed the title Add conditional powershell-yaml module check to Test-Tooling.ps1 feat: add conditional powershell-yaml module check to tooling test Dec 3, 2025
@jaredfholgate
Copy link
Member

@copilot the linting is failing because you left some trailing whitespace in the file you edited

Co-authored-by: jaredfholgate <1612200+jaredfholgate@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 3, 2025

@copilot the linting is failing because you left some trailing whitespace in the file you edited

Fixed the trailing whitespace issue. Changes made in commit f6e5ff0.

@oZakari oZakari merged commit 0aad3cc into main Dec 3, 2025
7 checks passed
@oZakari oZakari deleted the copilot/add-check-for-powershell-yaml branch December 3, 2025 21: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.

Feature Request: Add support for checking for powershell-YAML module installed in Test-Tooling.ps1

4 participants