
Backfilling cost data in Azure is essential for FinOps practices and for aligning with the FOCUS (FinOps Open Cost and Usage Specification) standard. While the Azure Portal only shows up to 13 months of exports, the Azure CLI allows you to retrieve the entire history across any scope and export.
This guide shows you how to:
- Run historical exports in Cloud Shell.
- Compare Portal vs CLI behavior.
- Use the process for all subscriptions, billing accounts, or enrollments.
Ensure your data pipeline is consistent with FOCUS.
Prerequisites
Before running exports, make sure you have:
- Permissions
- Cost Management Reader or higher on the scope.
- Storage Blob Data Contributor role on the storage account used for the export.
- Cost Management Reader or higher on the scope.
- Cloud Shell
- Open Azure Cloud Shell → choose PowerShell.
- CLI also works, but we’ll use Cloud Shell for simplicity.
- Open Azure Cloud Shell → choose PowerShell.
- Export Already Created
- You need at least one Cost Management Export defined in the Portal.
- You need at least one Cost Management Export defined in the Portal.
This export points to a storage account/container where CSV or Parquet files will be saved.
Step 1: Install Helper Module
Install-Module -Name CostExportV2IngestData
When prompted with the untrusted repository warning, select A (Yes to All).
Step 2: Run the Export Backfill
Use the command:
Invoke-CostExportV2IngestData -IgnoreRoleCheck
You’ll be guided through:
- Scope type (Enrollment, Billing Account, Subscription, etc.)
- Scope selection (e.g., specific Enrollment number)
- Export name (choose one of your existing exports)
Date range (start and end date)
Example Run (Anonymized)
Please select the scope type:
1 : Enrollment
2 : MCA Billing Account
3 : MCA Billing Profile
4 : Subscription
5 : Manual Input Scope
Enter the number of your selection (1-5): 1
You selected Enrollment.
Fetching Enrollment List...
Please select an Enrollment Number:
1: 12345678 - Example Bank
2: 87654321 - Example Group
3: 11223344 - Example Org
Enter the number of your selection: 3
Selected Enrollment: 11223344
Export Scope: /providers/Microsoft.Billing/billingAccounts/11223344
Fetching Export List...
Please select an Export:
1: AWS_Quick_Site
2: CGM-11223344-focus-export
3: Manually Input Export
Enter the number of your selection: 2
Export Name: CGM-11223344-focus-export
Please enter the full date range for the export.
Start Date (yyyy-MM-dd): 2022-10-01
End Date (yyyy-MM-dd): 2024-04-30
IgnoreRoleCheck is set. Skipping Storage Blob Data Contributor role validation and assignment.
Execution Output
Calling API for period: 2022-10-01T00:00:00.000Z to 2022-10-31T23:59:59.999Z
Export executed successfully.
Calling API for period: 2022-11-01T00:00:00.000Z to 2022-11-30T23:59:59.999Z
Export executed successfully.
Calling API for period: 2022-12-01T00:00:00.000Z to 2022-12-31T23:59:59.999Z
Export executed successfully.
...
Calling API for period: 2023-05-01T00:00:00.000Z to 2023-05-31T23:59:59.999Z
Export executed successfully.
Notice: Even though the Portal GUI only shows 13 months of history, the command successfully executes all months in the requested range.
Step 3: Verify in Storage
Check the Storage Account → Container you configured for the export.
You’ll see a CSV/Parquet file per month for the full date range.
Portal vs CLI: Key Difference
Feature | Azure Portal (GUI) | CLI / Cloud Shell |
Visible history | Max 13 months | All months backfilled |
Run on demand | Manual per export | Any export, any scope |
FOCUS dataset alignment | Limited | Full history for data lake |
Automation | ❌ No | ✅ Yes (scripts/pipelines) |
Important Considerations for FOCUS
- tandard Alignment
- If your export is configured for FOCUS, this process ensures you capture all historical data in the same format.
- If your export is configured for FOCUS, this process ensures you capture all historical data in the same format.
- Version Consistency
- If you’re using a specific FOCUS version, keep all exports on that version.
- Otherwise, re-export everything and rebuild your cost data lake for consistency.
- If you’re using a specific FOCUS version, keep all exports on that version.
- Repeat Across Exports
- This method works for all exports and scopes — not only the one you selected.
- This method works for all exports and scopes — not only the one you selected.
Run it for every export relevant to your FinOps reporting.
Quick Reference Commands
# Install module once
Install-Module -Name CostExportV2IngestData
# Run export backfill (guided)
Invoke-CostExportV2IngestData -IgnoreRoleCheck
With these steps, you can:
- Overcome the 13-month GUI limitation.
- Build a complete historical dataset.
- Ensure alignment with the FOCUS standard.
- Scale this method to all subscriptions and exports.