Azure VM DeallocationAnalysis Tool
Professional PowerShell script that identifies deallocated Azure VMs for lifecycle management. Track VM aging, ownership, and generate detailed CSV + HTML reports for better resource management.
Professional VM Lifecycle Management
Comprehensive analysis and reporting for deallocated Azure VMs with enterprise-grade features
KQL-Powered Discovery
Uses Azure Resource Graph KQL queries for fast, accurate discovery of deallocated VMs across all subscriptions
Intelligent Aging Analysis
Tracks deallocation dates via Activity Logs with smart estimates for VMs without historical data
Owner Detection
Automatically identifies VM owners through tag analysis including IDSApplicationOwner-Symphony patterns
Dual Report Formats
Generates both CSV (for analysis) and HTML (for executive reporting) with comprehensive VM details
Disk Analysis
Analyzes OS and data disk configurations with size estimates for complete storage impact assessment
Performance Modes
Fast Mode for quick scans or Detailed Mode for comprehensive Activity Log analysis
Enterprise Security
Respects Azure RBAC permissions and includes comprehensive error handling for production environments
Real-time Progress
Chef-themed console output with progress tracking and colorful status indicators for engaging analysis
Usage Examples
Real-world scenarios for VM lifecycle management and optimization
Basic Lifecycle Analysis
.\Detect-DeallocatedVMs.ps1
Identifies VMs deallocated for 30+ days across all accessible subscriptions with detailed aging analysis and owner detection.
Custom Threshold Analysis
.\Detect-DeallocatedVMs.ps1 -DaysThreshold 60
Focuses on VMs deallocated for 60+ days for more conservative lifecycle management and cleanup decisions.
High-Performance Scanning
.\Detect-DeallocatedVMs.ps1 -FastMode
Optimized for large environments, skips detailed Activity Log analysis and uses intelligent estimates for faster execution.
Targeted Subscription Analysis
.\Detect-DeallocatedVMs.ps1 -SubscriptionIds @("sub1", "sub2")
Focuses analysis on specific subscriptions for targeted lifecycle management and compliance reporting.
Technical Specifications
Enterprise-grade PowerShell script with comprehensive VM lifecycle analysis capabilities
Requirements
Windows PowerShell or PowerShell Core for cross-platform execution
Az.Accounts, Az.Resources, Az.ResourceGraph, Az.Compute, Az.Monitor
Interactive login or service principal with appropriate RBAC permissions
Reader access to subscriptions, Monitor Reader for Activity Logs
Local machine execution (no Azure Automation Account required)
Key Parameters
-DaysThreshold
Minimum days deallocated before inclusion (default: 30)
-SubscriptionIds
Array of specific subscription IDs to analyze
-OutputPath
Directory for CSV and HTML report output
-FastMode
Skip detailed Activity Log analysis for performance
Analysis Features
VM Discovery Engine
- • KQL-powered Azure Resource Graph queries
- • Multi-subscription parallel processing
- • Automatic VM state validation
- • Hardware profile and OS type detection
Aging Analysis
- • Activity Log deallocation date tracking
- • REST API optimization for recent events
- • Intelligent estimates for historical VMs
- • Configurable aging thresholds
Ownership Detection
- • IDSApplicationOwner-Symphony tag priority
- • Multiple owner tag pattern matching
- • Case-insensitive tag key searches
- • Fallback to common ownership patterns
Storage Analysis
- • OS and data disk size calculation
- • VM size-based storage estimates
- • Disk configuration breakdown
- • Total storage impact assessment
Report Outputs
Comprehensive reporting in multiple formats for different stakeholders
CSV Analysis Report
Detailed CSV export optimized for data analysis, filtering, and integration with business intelligence tools.
HTML Executive Report
Professional HTML report with visual summaries, charts, and executive-friendly presentation for stakeholder communication.
Chef's Tips & Best Practices
Professional recommendations for effective VM lifecycle management
Start Conservative
Begin with 60+ day thresholds for initial analysis. Like testing a new recipe with small portions, validate your VM lifecycle policies before implementing aggressive cleanup schedules.
Owner Engagement
Use the owner detection to reach out before cleanup. The script identifies owners through tags, enabling proactive communication about VM lifecycle decisions.
Performance Optimization
Use Fast Mode for large environments (1000+ VMs) to get quick insights. Switch to detailed mode for smaller scopes when precise deallocation dates are critical.
Security Considerations
Ensure proper RBAC permissions before analysis. The script respects Azure security boundaries and will only analyze resources you have access to view.
Regular Monitoring
Schedule monthly analysis to track VM lifecycle trends. Regular monitoring helps identify patterns and optimize your VM management policies over time.
Data Integration
Import CSV reports into Power BI or Excel for advanced analytics. The structured output enables trend analysis and executive dashboards for VM lifecycle management.
Ready to Optimize Your VM Lifecycle?
Download the Azure VM Deallocation Analysis Tool and start identifying optimization opportunities in your Azure environment today. Professional VM lifecycle management made simple.