Loading...
Loading...
Analyze Azure resources used in the app (IaC files and/or resources in a target rg) and optimize costs - creating GitHub issues for identified optimizations.
npx skill4agent add github/awesome-copilot az-cost-optimizeazmcp-*azmcp-bestpractices-getazmcp-subscription-listazmcp-group-list --subscription <subscription-id>az resource list --subscription <id> --resource-group <name>azmcp-cosmos-account-list --subscription <id>azmcp-storage-account-list --subscription <id>azmcp-monitor-workspace-list --subscription <id>azmcp-keyvault-key-listaz webapp listaz appservice plan listaz functionapp listaz sql server listaz redis listfile_searchazmcp-monitor-workspace-list --subscription <id>azmcp-monitor-table-list --subscription <id> --workspace <name> --table-type "CustomLog"azmcp-monitor-log-query// CPU utilization for App Services
AppServiceAppLogs
| where TimeGenerated > ago(7d)
| summarize avg(CpuTime) by Resource, bin(TimeGenerated, 1h)
// Cosmos DB RU consumption
AzureDiagnostics
| where ResourceProvider == "MICROSOFT.DOCUMENTDB"
| where TimeGenerated > ago(7d)
| summarize avg(RequestCharge) by Resource
// Storage account access patterns
StorageBlobLogs
| where TimeGenerated > ago(7d)
| summarize RequestCount=count() by AccountName, bin(TimeGenerated, 1d)az billingPriority Score = (Value Score × Monthly Savings) / (Risk Score × Implementation Days)
High Priority: Score > 20
Medium Priority: Score 5-20
Low Priority: Score < 5🎯 Azure Cost Optimization Summary
📊 Analysis Results:
• Total Resources Analyzed: X
• Current Monthly Cost: $X
• Potential Monthly Savings: $Y
• Optimization Opportunities: Z
• High Priority Items: N
🏆 Recommendations:
1. [Resource]: [Current SKU] → [Target SKU] = $X/month savings - [Risk Level] | [Implementation Effort]
2. [Resource]: [Current Config] → [Target Config] = $Y/month savings - [Risk Level] | [Implementation Effort]
3. [Resource]: [Current Config] → [Target Config] = $Z/month savings - [Risk Level] | [Implementation Effort]
... and so on
💡 This will create:
• Y individual GitHub issues (one per optimization)
• 1 EPIC issue to coordinate implementation
❓ Proceed with creating GitHub issues? (y/n)create_issue[COST-OPT] [Resource Type] - [Brief Description] - $X/month savings## 💰 Cost Optimization: [Brief Title]
**Monthly Savings**: $X | **Risk Level**: [Low/Medium/High] | **Implementation Effort**: X days
### 📋 Description
[Clear explanation of the optimization and why it's needed]
### 🔧 Implementation
**IaC Files Detected**: [Yes/No - based on file_search results]
```bash
# If IaC files found: Show IaC modifications + deployment
# File: infrastructure/bicep/modules/app-service.bicep
# Change: sku.name: 'S3' → 'B2'
az deployment group create --resource-group [rg] --template-file infrastructure/bicep/main.bicep
# If no IaC files: Direct Azure CLI commands + warning
# ⚠️ No IaC files found. If they exist elsewhere, modify those instead.
az appservice plan update --name [plan] --sku B2undefinedcreate_issue[EPIC] Azure Cost Optimization Initiative - $X/month potential savings# 🎯 Azure Cost Optimization EPIC
**Total Potential Savings**: $X/month | **Implementation Timeline**: X weeks
## 📊 Executive Summary
- **Resources Analyzed**: X
- **Optimization Opportunities**: Y
- **Total Monthly Savings Potential**: $X
- **High Priority Items**: N
## 🏗️ Current Architecture Overview
```mermaid
graph TB
subgraph "Resource Group: [name]"
[Generated architecture diagram showing current resources and costs]
endundefined