Fix Deploy-FinOpsHub version parsing for single-component version strings - #2304
Draft
Michael Flanakin (flanakin) wants to merge 3 commits into
Draft
Fix Deploy-FinOpsHub version parsing for single-component version strings#2304Michael Flanakin (flanakin) wants to merge 3 commits into
Michael Flanakin (flanakin) wants to merge 3 commits into
Conversation
…-FinOpsHub GitHub release tags in this repo are published as single-component strings (e.g. "13", "14", "15"). Deploy-FinOpsHub cast -Version directly to [version] in several parameter-gating checks, which throws for single-component strings since .NET's [version] parser requires at least major.minor. Add a small ConvertTo-NormalizedVersion private helper that appends ".0" when the version has no dot, and use it only for the [version] comparisons. The raw -Version value is still passed to Save-FinOpsHubTemplate so release tag resolution/download is unaffected. Fixes #2293
microsoft-github-policy-service
Bot
requested a review
from Brett Wilson (MSBrett)
September 8, 2026 01:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠️ Description
Deploy-FinOpsHubcasts-Versiondirectly to[version]in several parameter-gating checks (e.g.[version]$Version -ge '0.4') to decide which template parameters to pass. GitHub release tags in this repo are published as single-component strings ("13","14","15", ...), andSave-FinOpsHubTemplate -Version "13"correctly resolves and downloads them. But casting that same"13"string to[version]throws:because .NET's
[version]parser requires at least a major.minor value. SoDeploy-FinOpsHub -Version "13"downloaded the template fine and then crashed immediately after, on the first[version]$Versioncomparison.Fix
Added a small private helper,
ConvertTo-NormalizedVersion(src/powershell/Private/ConvertTo-NormalizedVersion.ps1), that appends.0to a version string when it has no..Deploy-FinOpsHubnow computes$normalizedVersion = ConvertTo-NormalizedVersion -Version $Versiononce, and uses it only in the[version]comparisons (all 7 gate checks, including the NAT Gateway/private-mode minimum-version check). The raw$Versionis unchanged everywhere else — most importantlySave-FinOpsHubTemplate -Version $Version, so release tag resolution/download still uses the exact tag name (passing"13.0"there would fail to find a matching release, as confirmed by the reporter).This mirrors the normalization already used as a test-only helper in
src/powershell/Tests/Integration/Toolkit.Tests.ps1(left untouched, per scope).Fixes #2293
📷 Screenshots
N/A — PowerShell parameter-parsing fix, no UI change.
📋 Checklist
🔬 How did you test this change?
Ran
Invoke-ScriptAnalyzeragainst the changed/added files (Deploy-FinOpsHub.ps1,ConvertTo-NormalizedVersion.ps1,Deploy-FinOpsHub.Tests.ps1) — no new findings introduced by this change. Ran the full Pester unit suite (npm run pester): 2298 passed, 0 failed, including 6 new/extended tests covering-Version "13"(no throw, same parameter set as"13.0"),"12"vs"12.0", and that an already-dotted version like"0.4"still works.📦 Deploy to test?
(none — no live Azure deployment was performed)
🙋♀️ Do any of the following that apply?
📑 Did you update
docs/changelog.md?📖 Did you update documentation?
🤖 Generated with Claude Code