Skip to content

Bump pinned Az PowerShell module versions in CI workflows - #2250

Closed
Michael Flanakin (flanakin) wants to merge 1 commit into
flanakin/v15-prepfrom
flanakin/945-az-version-bump
Closed

Bump pinned Az PowerShell module versions in CI workflows#2250
Michael Flanakin (flanakin) wants to merge 1 commit into
flanakin/v15-prepfrom
flanakin/945-az-version-bump

Conversation

@flanakin

Copy link
Copy Markdown
Collaborator

Summary

Issue #945 reports the deployment scripts printing Az PowerShell's built-in outdated-version warning ("You're using Az version 8.0.0. The latest version of Az is 12.2.0..."). That message is emitted by Az.Accounts itself at runtime, comparing the locally installed Az module against PSGallery — it is not text this repo generates, so there's no code path in src/scripts/ or src/powershell/ that "prints" it or that can be patched directly.

What is fixable in-repo: several CI workflows pin specific, multi-year-stale Az.* module versions via Install-Module -RequiredVersion / AZ_*_VERSION env vars, which would themselves trigger that same nag during CI runs (and give contributors who copy those pins into local scripts an outdated baseline). This PR bumps every one of those pins to the current PSGallery stable release, consistently across all files that reference them:

Module Old New
Az.Accounts 2.19.0 5.5.2
Az.Resources 6.16.2 10.1.0
Az.Storage 6.2.0 9.7.2
Az.OperationalInsights 3.2.0 3.4.1
Az.Sql 4.14.1 7.0.0
Az.Automation 1.10.0 1.12.1

Files updated:

  • .github/workflows/ftk-pr-deploy.yml (env vars AZ_ACCOUNTS_VERSION, AZ_RESOURCES_VERSION, AZ_STORAGE_VERSION, consumed by all deploy jobs + cache keys)
  • .github/workflows/ftk-pr-cleanup.yml
  • .github/workflows/opendata-instance-size-flexibility.yml
  • .github/workflows/aoe-cd-dev.yml, aoe-cd-test.yml, aoe-cd-prod.yml

No other RequiredVersion/MinimumVersion/RequiredModules pins exist elsewhere in the repo (checked src/scripts/, src/powershell/, all .psd1 manifests). Docs (docs/powershell.md, docs-mslearn/**) use unpinned Install-Module -Name Az.Accounts / Az.Resources, which is already correct and untouched.

References but does not close #945, since the actual user-facing warning is Az PowerShell's own runtime nag based on whatever Az version is installed on the machine running the deployment script — not something this repo enforces or can silence in code. Recommend closing #945 once this merges, with a note in the issue that the fix is "keep CI pins current" rather than "suppress the nag."

Test plan

  • pwsh -Command "./src/scripts/Test-PowerShell.ps1 -Lint" — 3418/3418 passed
  • Diffs reviewed — mechanical version-string substitutions only, no structural YAML changes
  • Verified no remaining references to the old version strings across .github/workflows/

The Az.Accounts/Resources/Storage/OperationalInsights/Sql/Automation
version pins in ftk-pr-deploy.yml, ftk-pr-cleanup.yml,
opendata-instance-size-flexibility.yml, and aoe-cd-*.yml were several
years stale (Az.Accounts 2.19.0, Az.Resources 6.16.2, etc.), causing
Az PowerShell's own outdated-version nag during CI runs. Bump each
pin to its current PSGallery stable release for consistency across
all workflows.

Refs #945
Copilot AI lite review requested due to automatic review settings August 12, 2026 22:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@microsoft-github-policy-service microsoft-github-policy-service Bot added Skill: DevOps GitHub setup and automation Needs: Review 👀 PR that is ready to be reviewed labels Aug 12, 2026
@flanakin Michael Flanakin (flanakin) added this to the v15 milestone Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Checked this against the actual CI logs. The diff itself is safe — but two claims in the description need correcting, and the change doesn't deliver the benefit it describes.

The pins aren't the source of the nag

From the last successful aoe-cd-dev run (31610513279) and the last opendata run (31362431808):

Result: '/usr/share/az_15.6.1/Az.Accounts/5.5.1/Az.Accounts.psd1'
WARNING: You're using Az version 15.6.1. The latest version of Az is 16.2.0.

The runners ship the Az rollup at 15.6.1, and the warning is emitted by that rollup during azure/login — before the "Installing modules" step runs. Bumping individual Az.* pins doesn't change the rollup version, so the same warning will still appear after this merges. See the inline notes for the follow-on point that the old pins were never actually loaded.

"No other pins exist elsewhere in the repo" isn't accurate

The grep looked for RequiredVersion/MinimumVersion and missed the PSGallery package-URL pins in src/optimization-engine/azuredeploy-nested.bicep (L855-904) and src/optimization-engine/upgrade-manifest.json, which set the Automation account's module versions:

Module Pinned
Az.Accounts 2.12.1
Az.Compute 5.7.0
Az.Resources 6.6.0
Az.Storage 5.5.0
Az.OperationalInsights 3.2.0
Az.ResourceGraph 0.13.0
Az.Monitor 4.4.1

Those are the versions that actually execute AOE in production, and they're staler than the CI pins. They shouldn't be bumped naively, though: the runbooks under src/optimization-engine/runbooks/ call Get-AzAccessToken without -AsSecureString (e.g. Ingest-OptimizationCSVExportsToLogAnalytics.ps1:156), which breaks on Az.Accounts >= 5.0 ("Changed the default output access token of Get-AzAccessToken from plain text to SecureString"). Leaving them alone is the right call here — just worth correcting the claim and tracking separately.

Compatibility checks — no blockers

  • All six new versions are the current PSGallery stable.
  • Inter-module deps resolve: Az.Resources 10.1.0 and Az.Storage 9.7.2 both require Az.Accounts >= 5.5.2.
  • Every Az cmdlet used by Deploy-AzureOptimizationEngine.ps1, src/scripts/, and src/powershell/ still exists in the new versions — including the Select-AzSubscription alias (verified in the 5.5.2 manifest), Remove-AzDataLakeGen2Item, and the AD cmdlets (now exported as functions after the Az.Resources 9.0 codegen change).
  • Get-AzAccessToken -AsSecureString is already used in src/powershell/Private/Invoke-Rest.ps1:67 and Deploy-AzureOptimizationEngine.ps1:1276.
  • Get-AzStorageBlobContent is used via pipeline (Add-FinOpsHubScope.ps1:71), not the -AbsoluteUri form restricted in Az.Storage 8.0.
  • Az.Sql 7.0 removed EnableSoftDelete from New/Set-AzSqlServer — unused here.

Validation gap

All PR Deploy checks are SKIPPED (label-gated) and Test-PowerShell.ps1 -Lint doesn't cover workflow YAML, so nothing in this PR was actually exercised. aoe-cd-dev runs unattended on push to dev, so it ends up as the canary. Worth applying the deploy labels before merging.

AZ_ACCOUNTS_VERSION: '2.19.0'
AZ_RESOURCES_VERSION: '6.16.2'
AZ_STORAGE_VERSION: '6.2.0'
AZ_ACCOUNTS_VERSION: '5.5.2'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Worth knowing before deciding on this approach: the old pins were never actually loaded, so Install-Module -RequiredVersion isn't governing anything here.

In the last aoe-cd-dev run the deploy step resolved to ~/.local/share/powershell/Modules/Az.Accounts/5.5.2, and in the last opendata run it resolved to the image's /usr/share/az_15.6.1/Az.Accounts/5.5.1. Neither ever loaded the pinned 2.19.0 — Install-Module -RequiredVersion installs side-by-side, it doesn't control what gets imported.

Two consequences:

  1. Risk here is much lower than 2.19.0 -> 5.5.2 suggests — CI was already effectively running Az.Accounts 5.5.x.
  2. The pins aren't buying anything. If the goal is a controlled baseline, either drop them entirely (saves ~30s/job plus the cache step below) or make them binding with an explicit Import-Module -RequiredVersion before the scripts run.

I'd lean toward dropping them: the AOE deploy script already depends on unpinned Az.Monitor from the runner image for Get-AzDataCollectionEndpoint, so the pin set was never complete anyway.

AZ_RESOURCES_VERSION: '6.16.2'
AZ_STORAGE_VERSION: '6.2.0'
AZ_ACCOUNTS_VERSION: '5.5.2'
AZ_RESOURCES_VERSION: '10.1.0'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One behavior change to keep an eye on across this jump: Az.Resources 8.0 release notes say "[Breaking Change] Updated API version of resource types from latest to DefaultApiVersion for cmdlets '-AzResource' and 'Invoke-AzResourceAction'."*

We use Get-AzResource in 12 places plus Remove-AzResource across src/scripts/ and src/powershell/. Given the pins were already being shadowed by the image's Az 15.6.1, this is probably already exercised in practice — but it's the one item in the changelogs that changes behavior rather than failing loudly.

run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module -Name Az.Accounts -RequiredVersion 2.19.0 -Force
Install-Module -Name Az.Accounts -RequiredVersion 5.5.2 -Force

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Concrete evidence for the point above — the last run of this workflow (31362431808) installed Az.Accounts 2.19.0 and then resolved to:

Result: '/usr/share/az_15.6.1/Az.Accounts/5.5.1/Az.Accounts.psd1'
WARNING: You're using Az version 15.6.1. The latest version of Az is 16.2.0.

The pin was inert, and the version warning came from the image's Az rollup — which this change doesn't affect.

Install-Module -Name Az.Accounts -RequiredVersion 5.5.2 -Force
Install-Module -Name Az.Resources -RequiredVersion 10.1.0 -Force
Install-Module -Name Az.Storage -RequiredVersion 9.7.2 -Force
Install-Module -Name Az.OperationalInsights -RequiredVersion 3.4.1 -Force

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor: this now diverges from src/optimization-engine/azuredeploy-nested.bicep:868, which still pins Az.OperationalInsights 3.2.0 for the Automation account. The deploy-time and runtime versions used to match. Not a problem, but flagging in case the match was intentional.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

These changes may be fine. I'm tempted to not touch AOE (unless Helder confirms these are okay), but this doesn't touch anything to do with the original issue. The original issue was referring to deployment scripts as part of Azure bicep deployment templates. This has nothing to do with CI/CD deployments. I'm not sure we need any of these changes, tho they may be fine, assuming they've been validated.

Comment on lines +27 to +32
Install-Module -Name Az.Accounts -RequiredVersion 5.5.2 -Force
Install-Module -Name Az.Resources -RequiredVersion 10.1.0 -Force
Install-Module -Name Az.Storage -RequiredVersion 9.7.2 -Force
Install-Module -Name Az.OperationalInsights -RequiredVersion 3.4.1 -Force
Install-Module -Name Az.Sql -RequiredVersion 7.0.0 -Force
Install-Module -Name Az.Automation -RequiredVersion 1.12.1 -Force

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Revert these

Comment on lines +27 to +32
Install-Module -Name Az.Accounts -RequiredVersion 5.5.2 -Force
Install-Module -Name Az.Resources -RequiredVersion 10.1.0 -Force
Install-Module -Name Az.Storage -RequiredVersion 9.7.2 -Force
Install-Module -Name Az.OperationalInsights -RequiredVersion 3.4.1 -Force
Install-Module -Name Az.Sql -RequiredVersion 7.0.0 -Force
Install-Module -Name Az.Automation -RequiredVersion 1.12.1 -Force

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Revert

Comment on lines +27 to +32
Install-Module -Name Az.Accounts -RequiredVersion 5.5.2 -Force
Install-Module -Name Az.Resources -RequiredVersion 10.1.0 -Force
Install-Module -Name Az.Storage -RequiredVersion 9.7.2 -Force
Install-Module -Name Az.OperationalInsights -RequiredVersion 3.4.1 -Force
Install-Module -Name Az.Sql -RequiredVersion 7.0.0 -Force
Install-Module -Name Az.Automation -RequiredVersion 1.12.1 -Force

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Revert

@MSBrett Brett Wilson (MSBrett) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The version updates themselves look safe.

However, they won’t fix the warning described in issue #945 because that warning comes from a different Azure PowerShell installation. Merge only as routine dependency maintenance, and keep #945 open.

@flanakin

Copy link
Copy Markdown
Collaborator Author

Closing this PR. On reflection, it targeted the wrong surface for #945 — that issue is specifically about FinOps hub deployment scripts, not CI workflow pins or the Optimization Engine. The version bumps here aren't harmful, but they're unvalidated (this repo's PR deploy checks only exercise template-changing PRs, not workflow-file-only changes, so there's no live signal that these six Az module bumps work end-to-end) and out of scope for what #945 actually asked for. Re-opening #945 against the real target: the toolkit's PowerShell module manifest (.build/BuildHelper/Build-PsModule.ps1, which currently pins Az.Accounts 2.17.0 / Az.Resources 6.5.1 as minimums) — the actual dependency surface for FinOps hub deployment via New-FinOpsCostExport and friends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skill: DevOps GitHub setup and automation Status: ▶️ Ready Issue is ready for a dev to start work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants