Proactively Monitor Azure Service Retirements with AzRetirementMonitor
Learn how to proactively monitor Azure service retirements across multiple subscriptions using the AzRetirementMonitor PowerShell module, helping you avoid disruptions and maintain compliance.
Azure’s cloud platform evolves rapidly, bringing new capabilities and improvements regularly. However, this evolution also means that older services, features, and APIs are periodically retired or deprecated. Missing these retirement notifications can lead to unexpected service disruptions, security vulnerabilities, compliance issues, and costly emergency migrations.
Azure provides several built-in tools to help you stay informed about retirements, including the Azure Advisor Retirements Workbook, Service Health alerts, and notifications within the Azure portal. These are excellent resources that many organizations rely on. However, different teams often need different approaches based on their workflows, automation requirements, and operational preferences.
To provide an additional option for retirement monitoring, I built AzRetirementMonitor, a PowerShell module that helps you proactively identify Azure resources affected by upcoming retirements by querying the Azure Advisor API across all your subscriptions. This tool complements existing Azure monitoring capabilities by offering a PowerShell-native approach that can be easily integrated into scripts, automation workflows, and CI/CD pipelines.
The Problem: Why Service Retirement Monitoring Matters
As organizations scale their Azure presence, keeping track of retirement notices becomes increasingly difficult. Consider these scenarios:
- A critical VM size you’re using is being retired in 90 days
- An API version your application depends on will stop working next month
- A storage service tier is being deprecated, requiring data migration
- A security feature is being replaced with a different implementation
While Azure provides several ways to monitor retirements, not every team or workflow fits neatly into those tools. Teams working outside of the Azure portal with PowerShell or other tool sets may benefit from having retirement data available in their existing automation workflows. AzRetirementMonitor provides this capability by offering automated, centralized visibility into all retirement recommendations across your Azure estate through familiar PowerShell commands.
What is AzRetirementMonitor?
AzRetirementMonitor is an open-source PowerShell module that leverages the Azure Advisor API to retrieve service upgrade and retirement recommendations. It specifically focuses on HighAvailability category recommendations with the ServiceUpgradeAndRetirement subcategory, giving you a filtered view of exactly what matters for service continuity.
This module complements Azure’s native monitoring capabilities by providing a PowerShell approach that integrates naturally into script-based workflows, making it easy to incorporate retirement checks into existing workflows and management tasks.
Key Features
- Multi-subscription support: Scan all your Azure subscriptions in one command
- Flexible authentication: Works with both Azure CLI and Az PowerShell module
- Multiple export formats: Generate reports in CSV, JSON, or HTML
- Detailed recommendations: Get actionable solutions with links to documentation
- PowerShell 7+ compatible: Modern PowerShell for cross-platform support
Getting Started
Prerequisites
You will need:
- PowerShell 7.0 or later
- Either Azure CLI or the Az.Accounts PowerShell module for authentication
- Appropriate permissions to read Azure Advisor recommendations
Installation
The easiest way to install AzRetirementMonitor is from the PowerShell Gallery:
1
Install-Module -Name AzRetirementMonitor -Scope CurrentUser
Alternatively, you can clone the repository from GitHub:
1
2
git clone https://github.com/cocallaw/AzRetirementMonitor.git
Import-Module ./AzRetirementMonitor/AzRetirementMonitor.psd1
Authentication
AzRetirementMonitor supports two authentication methods:
Option 1: Azure CLI (Default and Recommended)
1
2
3
4
5
# Login to Azure
az login
# Connect the module
Connect-AzRetirementMonitor
Option 2: Az PowerShell Module
1
2
3
4
5
6
7
8
# Install Az.Accounts if needed
Install-Module -Name Az.Accounts -Scope CurrentUser
# Connect to Azure
Connect-AzAccount
# Connect the module using Az PowerShell
Connect-AzRetirementMonitor -UseAzPowerShell
Using AzRetirementMonitor
Basic Usage
Once authenticated, getting retirement recommendations is straightforward:
1
2
# Get all retirement recommendations across all subscriptions
Get-AzRetirementRecommendation
The output includes:
- Subscription ID and resource ID
- Resource name and category
- Impact level (High, Medium, Low)
- Problem description
- Recommended solution
- Links to documentation
- Last updated timestamp
Targeting Specific Subscriptions
If you want to focus on particular subscriptions:
1
Get-AzRetirementRecommendation -SubscriptionId "sub-id-1", "sub-id-2"
Generating Reports
Export recommendations to share with your team:
1
2
3
4
5
6
7
8
# CSV for spreadsheet analysis
Get-AzRetirementRecommendation | Export-AzRetirementReport -OutputPath "report.csv" -Format CSV
# JSON for programmatic processing
Get-AzRetirementRecommendation | Export-AzRetirementReport -OutputPath "report.json" -Format JSON
# HTML for easy viewing and sharing
Get-AzRetirementRecommendation | Export-AzRetirementReport -OutputPath "report.html" -Format HTML
The HTML report provides a clean, formatted view of all retirement recommendations that’s easy to share with stakeholders:
Example of a generated HTML retirement report
Understanding Retirement Metadata
To get information about retirement recommendation types:
1
Get-AzRetirementMetadataItem
This provides metadata about the different types of retirement recommendations Azure Advisor can generate.
Complete Workflow Example
Here’s how I recommend using AzRetirementMonitor in your operations:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 1. Authenticate
Connect-AzRetirementMonitor
# 2. Retrieve all retirement recommendations
$recommendations = Get-AzRetirementRecommendation
# 3. Review critical items
$recommendations | Where-Object { $_.Impact -eq 'High' } | Format-Table ResourceName, Problem, Solution
# 4. Generate an HTML report for stakeholder review
$recommendations | Export-AzRetirementReport -OutputPath "weekly-retirement-report.html" -Format HTML
# 5. Export CSV for tracking in your change management system
$recommendations | Export-AzRetirementReport -OutputPath "retirement-tracking.csv" -Format CSV
Example Output
Here’s what a typical recommendation looks like:
1
2
3
4
5
6
7
8
9
10
11
SubscriptionId : 12345678-1234-1234-1234-123456789012
ResourceId : /subscriptions/.../resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/myVM
ResourceName : myVM
Category : HighAvailability
Impact : High
Problem : Virtual machine is using a retiring VM size
Solution : Migrate to a supported VM size before the retirement date
Description : Basic A-series VM sizes will be retired on August 31, 2024
LastUpdated : 2024-01-15T10:30:00Z
IsRetirement : True
LearnMoreLink : https://learn.microsoft.com/azure/virtual-machines/sizes-previous-gen
Contributing
AzRetirementMonitor is open source and welcomes contributions! Whether you’re reporting bugs, requesting features, or submitting pull requests, your input helps make the module better for everyone.
The project follows standard PowerShell module conventions and includes Pester tests. Check out the contributing guidelines in the repository for details.
Resources
- GitHub Repository: https://github.com/cocallaw/AzRetirementMonitor
- PowerShell Gallery: https://www.powershellgallery.com/packages/AzRetirementMonitor
- Azure Advisor Documentation: https://learn.microsoft.com/azure/advisor/
Final Thoughts
Proactive monitoring of Azure service retirements isn’t just about avoiding downtime; it’s about maintaining and improving resiliency while giving your team the time needed for proper planning, testing, and migration. AzRetirementMonitor makes this monitoring accessible through simple PowerShell commands that can be integrated into your existing workflows.
Whether you’re managing a handful of resources or a massive Azure estate, staying ahead of service retirements is crucial. Give AzRetirementMonitor a try and let me know what you think!
Have questions or suggestions? Feel free to open an issue on GitHub or reach out. I’m always looking to improve the module based on real-world usage.
Happy monitoring! 🚀