Skip to content

Fix/pssa shouldprocess#36

Merged
jfaurskov merged 9 commits intomainfrom
fix/pssa-shouldprocess
Apr 10, 2026
Merged

Fix/pssa shouldprocess#36
jfaurskov merged 9 commits intomainfrom
fix/pssa-shouldprocess

Conversation

@lvlindv
Copy link
Copy Markdown
Collaborator

@lvlindv lvlindv commented Apr 9, 2026

This pull request introduces several improvements and bug fixes across multiple PowerShell scripts, focusing on enhancing parameter validation, improving commandlet behavior, and correcting logic for cost reporting.

Enhancements to Cmdlet Declarations and Suppression Attributes:

  • Added [CmdletBinding()] and suppression attributes to Set-ColumnColor, New-Worksheet, and Set-SvcAvailReportObj in 7-Report/Get-Report.ps1 to improve cmdlet consistency and suppress warnings about ShouldProcess usage. [1] [2] [3]

Cost Reporting and Logic Fixes:

  • Changed the cost report generation window from 1 day to 30 days in Invoke-CostReportSchedule to provide a broader cost analysis.
  • Fixed a bug in Get-AzureServices.ps1 by ensuring meter IDs are only retrieved when both $includeCost is true and $costDetails is not null, preventing errors when cost details are missing.

Improvements to Availability Check Cmdlets:

  • Added [CmdletBinding(SupportsShouldProcess)] to Update-SKUPropertySet in 2-AvailabilityCheck/Get-AvailabilityInformation.ps1 to align with best practices for state-changing functions.

lvlindv added 3 commits April 9, 2026 14:33
- Add CmdletBinding(SupportsShouldProcess) to Update-SKUPropertySet,
  Set-ColumnColor, New-Worksheet, Set-SvcAvailReportObj
- Fix cost date range from 1 day to 30 days in Invoke-CostReportSchedule
- Guard Get-MeterId call against null costDetails
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates several PowerShell scripts to address PSScriptAnalyzer ShouldProcess guidance, improve cmdlet-style declarations, and fix/adjust cost-reporting behavior.

Changes:

  • Added [CmdletBinding()] / suppression attributes (and an [OutputType]) to reporting helper functions in 7-Report/Get-Report.ps1.
  • Adjusted cost report date range to 30 days and guarded meter ID extraction when cost details are missing in 1-Collect/Get-AzureServices.ps1.
  • Added SupportsShouldProcess to Update-SKUPropertySet in 2-AvailabilityCheck/Get-AvailabilityInformation.ps1.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
7-Report/Get-Report.ps1 Adds cmdlet-binding metadata and suppresses PSSA ShouldProcess warnings for report-related helper functions.
2-AvailabilityCheck/Get-AvailabilityInformation.ps1 Adds SupportsShouldProcess to a state-mutating helper used during SKU availability mapping.
1-Collect/Get-AzureServices.ps1 Expands the cost report window and prevents meter ID lookups when cost details are unavailable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread 7-Report/Get-Report.ps1 Outdated
Comment thread 7-Report/Get-Report.ps1
Comment thread 7-Report/Get-Report.ps1 Outdated
Comment thread 2-AvailabilityCheck/Get-AvailabilityInformation.ps1
lvlindv and others added 6 commits April 10, 2026 10:45
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Removed CmdletBinding attribute from Update-SKUPropertySet function.
Removed SuppressMessage attribute and CmdletBinding from Set-ColumnColor function.
Removed unnecessary attributes from New-Worksheet function.
Removed unnecessary SuppressMessageAttribute and CmdletBinding from Set-SvcAvailReportObj function.
Copy link
Copy Markdown
Collaborator

@jfaurskov jfaurskov left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread 2-AvailabilityCheck/Get-AvailabilityInformation.ps1 Outdated
Comment thread 2-AvailabilityCheck/Get-AvailabilityInformation.ps1
Comment thread 7-Report/Get-Report.ps1 Outdated
Comment thread 7-Report/Get-Report.ps1
Comment thread 7-Report/Get-Report.ps1 Outdated
@jfaurskov jfaurskov merged commit 9e40148 into main Apr 10, 2026
4 checks passed
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.

3 participants