fix: SiteScope All enumeration pollution + DryRun would-apply outcome - #27
Merged
Conversation
Two bugs found during live runbook testing of SiteScope: All:
1. Get-TenantSiteUrls emitted informational text via Write-Output, which
PowerShell captured into the returned array, so status strings were
processed as bogus site URLs ('Invalid URI'). Use Write-Verbose inside
the function and return only the URL array (return ,[string[]]); the
caller logs the discovered/processed count.
2. In DryRun the site version policy path recorded Outcome='Applied' even
though ShouldProcess prevented the change. Record 'WouldApply' and log
'would apply' in DryRun; the report card and summary reflect it.
Bump to 3.1.3.
Refs #26
Note the SiteScope: All enumeration fix and the DryRun would-apply outcome in CHANGELOG/RELEASE-NOTES, and soften the Configuration app-only note now that live testing confirmed Get-PnPTenantSite and Get-PnPSiteVersionPolicy reads work with a Managed Identity. Refs #26
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.
Closes #26
Two bugs found during live Azure Automation runbook testing.
Bug 1 — Enumeration pollution (SiteScope: All)
Get-TenantSiteUrlsemitted status viaWrite-Output, which PowerShell captured into the returned array. The status strings were then processed as sites and failed:Fix: informational messages use
Write-Verbose; the function returns only the URL array (return ,[string[]]$urls); the caller logs the discovered/processed count.Bug 2 — DryRun reported 'Applied'
In DryRun the site version policy path recorded
Appliedeven thoughShouldProcess/-WhatIfblocked the change. Fix: record a WouldApply outcome and log 'would apply'; the report card ('Would apply') and run summary ('N would apply') reflect the simulation.Bonus (confirmed app-only behaviour)
Live testing showed
Get-PnPTenantSiteandGet-PnPSiteVersionPolicyreads work with a Managed Identity (SiteScope: All + InheritFromTenant enumerated 9 sites, all 'no drift'). The wiki app-only note is softened accordingly.Testing
Invoke-Pester-> 116 passed, 0 failed. Enumeration purity and DryRun would-apply verified functionally. Version bumped to 3.1.3.