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: rubyCopyEdit
https://prices.azure.com/api/retail/prices?$filter=serviceName eq 'Virtual Machines'
- 🔹 Storage pricing for East US: rubyCopyEdit
https://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:
Field | Meaning |
---|---|
unitPrice | Retail price per unit (e.g., per hour or per GB) |
meterName | Description of the billing unit |
skuName | SKU identifier (e.g., D2_v3 ) |
armRegionName | Azure region (e.g., eastus ) |
productName | Product group (e.g., Virtual Machines ) |
effectiveStartDate | Date 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:
- Query the API with: bashCopyEdit
$filter=serviceName eq 'Storage' and skuName eq 'Standard_LRS' and meterName eq 'Data Stored'
- Export and sort by
armRegionName
andunitPrice
.
✅ Summary
Task | Action |
---|---|
Get prices | Use Retail API: https://prices.azure.com/api/retail/prices |
Filter data | Use $filter on serviceName , armRegionName , etc. |
Export to file | Use Python or PowerShell to handle pagination |
Use cases | Estimate 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.