Conversation
Changed default behavior to use the Az.Advisor PowerShell module for retrieving Azure retirement recommendations, with REST API access now available via the -UseAPI switch. Added Test-AzAdvisorSession for module/session validation, updated Connect-AzRetirementMonitor to require -UsingAPI for API mode, and improved documentation and error handling throughout. This is a breaking change and requires Az.Advisor for default usage; see release notes for migration details.
Introduces QUICKSTART.md with setup instructions, usage examples, troubleshooting tips, and migration notes for AzRetirementMonitor v2.0. Highlights new default method using Az.Advisor and provides guidance for both PowerShell and API workflows.
Documents major changes in version 2.0.0, including the new default use of the Az.Advisor module, updated authentication workflows, and the introduction of API mode via switches. Adds migration guidance, clarifies command usage, updates example outputs, and provides a comparison table between the default and API methods. Improves overall structure and detail for installation, authentication, and usage scenarios.
Improved detection of retirement recommendations by parsing extended properties for retirementFeatureName and retirementDate, and updated logic to check both text and extended properties. Also, switched to using ResourceMetadataResourceId for resource identification and improved description building to prefer retirement feature details.
* Expand PowerShell compatibility in module manifest Updated AzRetirementMonitor.psd1 to support both PowerShell Core (7+) and Desktop (5.1) editions. This change broadens compatibility for users on different PowerShell platforms. * Fix UTC time generation for PowerShell 5.1 compatibility Replaced usage of Get-Date -AsUTC with [DateTime]::UtcNow to ensure compatibility with PowerShell 5.1, which does not support the -AsUTC parameter. * Update README for PowerShell compatibility Clarifies that the module now supports both PowerShell Desktop 5.1 and Core 7+, updating prerequisites and feature notes to reflect expanded compatibility. * Update QUICKSTART.md
Added clarification that both PowerShell Desktop 5.1 and Core 7+ are supported. Improved formatting and readability in QUICKSTART.md and README.md for better guidance and migration instructions.
…law/AzRetirementMonitor into feature/add-wrkbookrecs-ps
Transforms the Solution field to use Description when Problem and Solution are identical and Description exists, providing more informative output for Az.Advisor mode in CSV, JSON, and HTML exports.
Updated the HTML export table header to use 'Description' instead of 'Solution' for clarity and consistency with report content.
Added the -UseAPI parameter to relevant Connect-AzRetirementMonitor and Get-AzRetirementRecommendation calls in the test suite to ensure API-based authentication and error handling are properly validated.
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces a major breaking change to the AzRetirementMonitor PowerShell module by shifting from REST API-based access to using the Az.Advisor PowerShell module as the default method for retrieving Azure service retirement recommendations. The REST API remains available as an opt-in alternative via the -UseAPI switch.
Changes:
- Default behavior changed to use Az.Advisor PowerShell module instead of REST API
- PowerShell Desktop 5.1 support added alongside existing Core 7+ support
- New mandatory
-UsingAPIparameter on Connect-AzRetirementMonitor to prevent accidental use when not needed - Enhanced export functionality with improved Description/Solution field handling for better data clarity
- New Test-AzAdvisorSession private function for validating Az.Advisor module availability and active Azure sessions
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/AzRetirementMonitor.Tests.ps1 | Updated existing tests to add -UsingAPI parameter to Connect-AzRetirementMonitor calls and -UseAPI to Get-AzRetirementRecommendation calls for API mode testing |
| README.md | Comprehensive documentation updates explaining the new default vs API methods, migration guide from v1.x, updated authentication instructions, and feature comparison table |
| QUICKSTART.md | New quick start guide showing both recommended (Az.Advisor) and alternative (REST API) workflows with troubleshooting section |
| Public/Get-AzRetirementRecommendation.ps1 | Implements dual-mode support: default Az.Advisor module mode and opt-in REST API mode via -UseAPI switch |
| Public/Get-AzRetirementMetadataItem.ps1 | Updated error messages to clarify API-only access requirement and reference -UsingAPI parameter |
| Public/Export-AzRetirementReport.ps1 | Enhanced export logic to use Description field when Problem equals Solution, with PowerShell 5.1 compatibility for date formatting |
| Public/Connect-AzRetirementMonitor.ps1 | Added mandatory -UsingAPI parameter to confirm API-based access intent, with updated help documentation |
| Private/Test-AzAdvisorSession.ps1 | New validation function checking Az.Advisor module availability and active Azure PowerShell context |
| AzRetirementMonitor.psd1 | Version bumped to 2.0.0, PowerShell compatibility updated to 5.1+ supporting both Desktop and Core, release notes added |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
Contributor
…ptions via Az.Advisor (#19) * Initial plan * Fix subscription context handling in Get-AzRetirementRecommendation Co-authored-by: cocallaw <11371083+cocallaw@users.noreply.github.com> * Add error handling for context restoration Co-authored-by: cocallaw <11371083+cocallaw@users.noreply.github.com> * Update Public/Get-AzRetirementRecommendation.ps1 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Public/Get-AzRetirementRecommendation.ps1 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add test coverage for subscription context switching behavior Co-authored-by: cocallaw <11371083+cocallaw@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cocallaw <11371083+cocallaw@users.noreply.github.com> Co-authored-by: Corey Callaway <coreylcallaway@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…entReport (#20) * Initial plan * Refactor: extract duplicated transformation logic before switch statement Co-authored-by: cocallaw <11371083+cocallaw@users.noreply.github.com> * Update Public/Export-AzRetirementReport.ps1 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add functional tests for transformation logic Co-authored-by: cocallaw <11371083+cocallaw@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cocallaw <11371083+cocallaw@users.noreply.github.com> Co-authored-by: Corey Callaway <coreylcallaway@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…t-AzRetirementReport help (#21) * Initial plan * Enhanced Export-AzRetirementReport help documentation Co-authored-by: cocallaw <11371083+cocallaw@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cocallaw <11371083+cocallaw@users.noreply.github.com>
Refactored the transformation of recommendation objects to ensure all properties are strings and not arrays, improving export consistency. Enhanced CSV export by explicitly sanitizing all fields to prevent formula injection in spreadsheet applications. This improves data safety and reliability for CSV consumers.
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.
This pull request introduces a major update to the AzRetirementMonitor PowerShell module, shifting the default behavior to use the Az.Advisor PowerShell module for retrieving Azure service retirement recommendations, while retaining REST API support as an opt-in mode. It also expands compatibility to PowerShell Desktop (5.1), adds improved error handling and messaging, and enhances the export and reporting features for better data clarity.
closes #16
Default behavior and compatibility changes:
-UseAPIswitch, andConnect-AzRetirementMonitoris only required for API access (-UsingAPIswitch). PowerShell Desktop (5.1) is now supported in addition to Core (7+). (AzRetirementMonitor.psd1,Public/Connect-AzRetirementMonitor.ps1,Public/Get-AzRetirementRecommendation.ps1, [1] [2] [3] [4] [5]Command and parameter updates:
Connect-AzRetirementMonitornow requires the-UsingAPIswitch and is only needed for API-based access. The help documentation and parameter sets have been updated to clarify usage scenarios and to prevent accidental use when not needed. (Public/Connect-AzRetirementMonitor.ps1, [1] [2] [3]Get-AzRetirementRecommendationadds a-UseAPIswitch, with updated logic to use either the Az.Advisor module (default) or REST API (when specified). The function checks for module/session availability and provides clearer error messages and help documentation. (Public/Get-AzRetirementRecommendation.ps1, [1] [2]New and improved validation:
Test-AzAdvisorSessionto verify that the Az.Advisor module is installed and an active Azure session exists before attempting module-based operations, improving reliability and user guidance. (Private/Test-AzAdvisorSession.ps1, Private/Test-AzAdvisorSession.ps1R1-R52)Export/reporting enhancements:
Export-AzRetirementReportto improve the "Solution" column: when using Az.Advisor, if "Problem" and "Solution" are identical, the more informative "Description" is used instead. Also, improved PowerShell 5.1 compatibility for date formatting and clarified HTML export columns. (Public/Export-AzRetirementReport.ps1, [1] [2] [3] [4]Documentation and error message improvements:
Public/Get-AzRetirementMetadataItem.ps1,Public/Get-AzRetirementRecommendation.ps1, [1] [2]These changes represent a significant usability and compatibility improvement, with a clear separation between default (module-based) and advanced (API-based) usage, enhanced error handling, and improved reporting outputs.