$npx -y skills add thomast1906/github-copilot-agent-skills --skill cost-optimizationAnalyze Azure architectures for cost optimization opportunities, provide savings recommendations, and calculate ROI for improvements.
| 1 | # Cost Optimization Skill |
| 2 | |
| 3 | Analyze Azure costs and identify optimization opportunities across compute, storage, networking, and data services. Provide actionable recommendations with savings estimates. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - Review architecture costs and identify waste |
| 8 | - Optimize existing Azure deployments |
| 9 | - Right-size over-provisioned resources |
| 10 | - Implement reserved instances and savings plans |
| 11 | - Set up cost monitoring and alerts |
| 12 | - Reduce monthly Azure bills |
| 13 | |
| 14 | ## Cost Optimization Categories |
| 15 | |
| 16 | ### 1. Right-Sizing |
| 17 | Adjust resource SKUs to match actual usage patterns. |
| 18 | |
| 19 | **Target Resources:** |
| 20 | - Virtual Machines |
| 21 | - App Service Plans |
| 22 | - SQL Databases |
| 23 | - Cosmos DB throughput |
| 24 | - Azure Cache for Redis |
| 25 | |
| 26 | **Analysis Method:** |
| 27 | 1. Review 30-day metrics (CPU, memory, DTU utilization) |
| 28 | 2. Identify resources with < 40% average utilization |
| 29 | 3. Recommend smaller SKU or scaling adjustments |
| 30 | |
| 31 | **Typical Savings:** 30-50% |
| 32 | |
| 33 | ### 2. Reserved Instances & Savings Plans |
| 34 | Commit to 1-year or 3-year terms for predictable workloads. |
| 35 | |
| 36 | **Eligible Services:** |
| 37 | - Virtual Machines |
| 38 | - App Service Plans |
| 39 | - Azure SQL Database |
| 40 | - Cosmos DB |
| 41 | - Azure Cache for Redis |
| 42 | |
| 43 | **Savings (typical ranges — always verify with the `azure-pricing` skill using `price-type: Reservation`):** |
| 44 | - 1-year: 20-40% |
| 45 | - 3-year: 40-72% |
| 46 | |
| 47 | **When to Use:** Workloads with consistent, predictable usage |
| 48 | |
| 49 | **To confirm exact RI rates:** use `tool_search_tool_regex` with pattern `pricing`, then call the tool with `price-type: Reservation` and `include-savings-plan: true` for the specific SKU and region. Compare the returned `retailPrice` against the `Consumption` rate to calculate the actual saving percentage. |
| 50 | |
| 51 | ### 3. Auto-Scaling |
| 52 | Scale resources based on demand instead of static provisioning. |
| 53 | |
| 54 | **Applicable Services:** |
| 55 | - App Service |
| 56 | - Virtual Machine Scale Sets |
| 57 | - Container Apps |
| 58 | - AKS node pools |
| 59 | - Cosmos DB autoscale |
| 60 | |
| 61 | **Typical Savings:** 20-40% (eliminates idle capacity during off-peak) |
| 62 | |
| 63 | ### 4. Storage Tiering |
| 64 | Move infrequently accessed data to cheaper storage tiers. |
| 65 | |
| 66 | **Blob Storage Tiers:** |
| 67 | - **Hot**: Frequent access (< 30 days old) |
| 68 | - **Cool**: Infrequent access (30-90 days), 50% cheaper |
| 69 | - **Archive**: Rare access (> 90 days), 90% cheaper |
| 70 | |
| 71 | **Implementation:** Lifecycle management policies |
| 72 | |
| 73 | **Typical Savings:** 50-90% on archived data |
| 74 | |
| 75 | ### 5. Eliminate Waste |
| 76 | Identify and remove unused resources. |
| 77 | |
| 78 | **Common Waste:** |
| 79 | - Unattached disks |
| 80 | - Stopped (but not deallocated) VMs |
| 81 | - Orphaned public IPs |
| 82 | - Unused App Service Plans |
| 83 | - Old snapshots and backups |
| 84 | - Idle Load Balancers |
| 85 | |
| 86 | **Typical Savings:** £200-2,000/month per environment |
| 87 | |
| 88 | ## Cost Analysis Process |
| 89 | |
| 90 | ### Step 0: Retrieve Live Pricing with Azure MCP Pricing Tool |
| 91 | |
| 92 | **Before estimating any costs, invoke the `azure-pricing` skill to fetch real retail prices.** |
| 93 | |
| 94 | First, use `tool_search_tool_regex` with pattern `pricing` to discover the exact tool name — do **not** hardcode it. Then call the tool with: |
| 95 | |
| 96 | ``` |
| 97 | sku: <ARM SKU e.g. Standard_D4ds_v5> |
| 98 | service: <e.g. Virtual Machines, Azure Kubernetes Service> |
| 99 | region: <ARM region slug e.g. uksouth, eastus> |
| 100 | currency: GBP |
| 101 | price-type: Consumption # on-demand baseline |
| 102 | include-savings-plan: true # returns 1yr/3yr rates in nested array |
| 103 | ``` |
| 104 | |
| 105 | Then follow up with `price-type: Reservation` to retrieve exact reserved instance rates. |
| 106 | |
| 107 | **Monthly cost formula:** `hourly_price × 730` |
| 108 | |
| 109 | **Important:** The tool requires a specific SKU or service name — do not call it with only a broad category (e.g. "Virtual Machines"). Confirm the SKU before calling. |
| 110 | |
| 111 | Build a three-column cost table per resource: |
| 112 | |
| 113 | | Resource | Pay-as-you-go | 1-yr Reserved | 3-yr Reserved | |
| 114 | |----------|--------------|---------------|---------------| |
| 115 | | (data from pricing tool) | | | | |
| 116 | |
| 117 | ### Step 1: Gather Current Costs |
| 118 | |
| 119 | Extract cost data from Azure Cost Management: |
| 120 | - Last 30-60 days of spending by resource |
| 121 | - Group by resource type and resource group |
| 122 | - Identify top 10 cost contributors |
| 123 | |
| 124 | ### Step 2: Analyze Resource Utilization |
| 125 | |
| 126 | For each major resource: |
| 127 | - **Compute**: Average CPU, memory utilization |
| 128 | - **Database**: DTU/vCore usage, storage growth |
| 129 | - **Storage**: Access patterns, growth rate |
| 130 | - **Networking**: Bandwidth usage, idle resources |
| 131 | |
| 132 | ### Step 3: Identify Opportunities |
| 133 | |
| 134 | Categorize findings: |
| 135 | - **Quick Wins**: < 1 hour, immediate savings (delete unused resources) |
| 136 | - **Right-Sizing**: < 1 day, 30-50% savings |
| 137 | - **Reserved Instances**: < 1 hour setup, 1-3 year commitment |
| 138 | - **Architecture Changes**: > 1 week, significant redesign |
| 139 | |
| 140 | ### Step 4: Calculate ROI |
| 141 | |
| 142 | For each recommendation: |
| 143 | - Current monthly cost |
| 144 | - Optimized monthly cost |
| 145 | - Monthly savings |
| 146 | - Implementation effort (hours) |
| 147 | - Break-even time |
| 148 | |
| 149 | ## Output Format |
| 150 | |
| 151 | > **Note:** All cost figures in the template below are illustrative placeholders. Before |