✅ How to Export Azure Pricing Data for SKUs and Services

Azure pricing data can be helpful for cost estimation, budget planning, and SKU comparisons. While cost exports show what you’ve spent, the Retail Prices API lets you retrieve up-to-date list prices for Azure services—like VMs, storage, and databases—without needing authentication.


🌐 1. Use the Azure Retail Prices API

Microsoft offers a public REST API to get pay-as-you-go pricing for most Azure services:

Base endpoint:

https://prices.azure.com/api/retail/prices

Each result contains:

  • productName, skuName, meterName
  • unitPrice, armRegionName, unitOfMeasure
  • effectiveStartDate, currencyCode

No login is required—just call the API in your browser or a script.


🔍 2. Filtering the Pricing Data

Use the $filter query parameter to narrow results:

Examples:

  • 🔹 All VM pricing: rubyCopyEdithttps://prices.azure.com/api/retail/prices?$filter=serviceName eq 'Virtual Machines'
  • 🔹 Storage pricing for East US: rubyCopyEdithttps://prices.azure.com/api/retail/prices?$filter=serviceName eq 'Storage' and armRegionName eq 'eastus'
  • 🔹 LRS storage cost per GB: bashCopyEdit$filter=serviceName eq 'Storage' and skuName eq 'Standard_LRS' and meterName eq 'Data Stored'

⚠️ The API is case-sensitive, so use exact field names (e.g., 'Virtual Machines' not 'virtual machines').


📄 3. Export Pricing to CSV via Script

The API is paginated, so you’ll need to handle NextPageLink to retrieve all records.

✅ Python Example:

import requests
import csv

url = "https://prices.azure.com/api/retail/prices?$filter=serviceName eq 'Virtual Machines'"
all_prices = []

while url:
response = requests.get(url).json()
all_prices.extend(response.get("Items", []))
url = response.get("NextPageLink")

# Write to CSV
with open("azure_vm_prices.csv", "w", newline='', encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=all_prices[0].keys())
writer.writeheader()
writer.writerows(all_prices)

This will create a full export of VM pricing in your local file.

💡 You can also use PowerShell with Invoke-RestMethod to pull and export pricing.


📦 4. Understanding API Output

Key fields to know:

FieldMeaning
unitPriceRetail price per unit (e.g., per hour or per GB)
meterNameDescription of the billing unit
skuNameSKU identifier (e.g., D2_v3)
armRegionNameAzure region (e.g., eastus)
productNameProduct group (e.g., Virtual Machines)
effectiveStartDateDate the pricing became active

🔐 5. For Enterprise or Discounted Rates

The Retail Prices API only shows list prices.

If you’re an Enterprise Agreement (EA) or MCA customer with negotiated rates:

  • Use the RateCard API (requires Azure AD app + subscription ID).
  • Or compare list prices with actual costs from your Cost Export or Cost Management APIs.

💡 Note: The RateCard API is more complex and not supported for all agreement types.


📊 6. How to Use the Data

Once you export pricing:

  • 🔄 Join with usage data to model expected costs.
  • 📈 Compare SKUs across regions or tiers.
  • 🔍 Validate invoices or calculate potential savings from Reserved Instances.

Example:

To compare Standard_LRS storage prices across regions:

  1. Query the API with: bashCopyEdit$filter=serviceName eq 'Storage' and skuName eq 'Standard_LRS' and meterName eq 'Data Stored'
  2. Export and sort by armRegionName and unitPrice.

✅ Summary

TaskAction
Get pricesUse Retail API: https://prices.azure.com/api/retail/prices
Filter dataUse $filter on serviceName, armRegionName, etc.
Export to fileUse Python or PowerShell to handle pagination
Use casesEstimate costs, compare SKUs, validate spend

🎯 Result: You get a clean, exportable file of current Azure retail pricing by service, region, and SKU—ideal for modeling and financial planning.