Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Analyze and reduce Azure cloud costs by right-sizing resources, reservations, and spending policies
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/tools-and-best-practices.md
1# Azure Cost Skill Reference23## MCP Tools45| Tool | Description | Parameters | When to Use |6|------|-------------|------------|-------------|7| `azure__documentation` | Search Azure documentation | `query` (Required): search terms | Research Cost Management API parameters and options |8| `azure__extension_cli_generate` | Generate Azure CLI commands | `intent` (Required): task description, `cli-type` (Required): `"az"` | Construct `az rest` commands for cost queries |9| `azure__get_azure_bestpractices` | Get Azure best practices | `intent` (Required): optimization context | Inform query design with cost management best practices |10| `azure__extension_azqr` | Run Azure Quick Review compliance scan | `subscription` (Required): subscription ID, `resource-group` (Optional): resource group name | Find orphaned resources and cost optimization opportunities |11| `azure__aks` | Azure Kubernetes Service operations | varies by sub-command | AKS cost analysis: list clusters, get node pools, inspect configuration |1213> Prefer MCP tools over direct CLI commands. Use `az rest` only when MCP tools don't cover the specific operation.1415## Data Classification1617- **ACTUAL DATA** = Retrieved from Azure Cost Management API18- **ACTUAL METRICS** = Retrieved from Azure Monitor19- **VALIDATED PRICING** = Retrieved from official Azure pricing pages20- **ESTIMATED SAVINGS** = Calculated based on actual data and validated pricing2122## Best Practices2324- Always query actual costs first, never estimate or assume25- Always present the total bill alongside optimization recommendations26- Validate pricing from official sources, account for free tiers27- Use REST API for cost queries (more reliable than `az costmanagement query`)28- Always include the `ClientType: GitHubCopilotForAzure` header on all Cost Management API requests (`--headers "ClientType=GitHubCopilotForAzure"` in `az rest`)29- Save audit trail with all queries and responses30- Include Azure Portal links for all resources31- For costs < $10/month, emphasize operational improvements over financial savings32- Never execute destructive operations without explicit approval33- On 429 responses, check all `x-ms-ratelimit-microsoft.costmanagement-*-retry-after` headers (`qpu-retry-after`, `entity-retry-after`, `tenant-retry-after`), wait for the longest value, and don't retry until that duration has elapsed. The per-scope limit (4 requests/minute) is the most restrictive.3435## Common Pitfalls3637- **Assuming costs**: Always query actual data from Cost Management API38- **Ignoring free tiers**: Many services have generous allowances39- **Using wrong date ranges**: 30 days for costs, 14 days for utilization40- **Not showing the bill**: Always present cost breakdown alongside optimization recommendations41- **Cost query failures**: Use `az rest` with JSON body, not `az costmanagement query`4243## Safety Requirements4445- Get approval before deleting resources46- Test changes in non-production first47- Provide dry-run commands for validation48- Include rollback procedures49