Skip to main content

Configuring Azure Cost Management Exports

This guide walks you through setting up Cost Management Exports in Azure. CloudYali requires daily cost exports to analyze your spending and provide cost insights.


Overview

To enable cost tracking in CloudYali, you need to:

  1. ✅ Create an Azure Storage Account (if you don't have one)
  2. ✅ Create a Blob container for cost exports
  3. ✅ Configure a Cost Management Export with daily schedule
  4. ✅ Grant your Service Principal access to the storage account

Step 1: Create Storage Account

Using Azure Portal:

  1. Go to Azure Portal → Storage accounts
  2. Click + Create
  3. Fill in the form:
    • Resource group: Select existing or create new (e.g., cloudyali-exports)
    • Storage account name: cloudyalicosts{yourname} (must be globally unique, lowercase only)
    • Region: Same as your primary resources
    • Performance: Standard
    • Redundancy: Locally-redundant storage (LRS)
  4. Click Review + CreateCreate

Save the storage account name - you'll need it later.


Step 2: Create Blob Container

  1. Go to the storage account you just created
  2. Click Containers in the left menu
  3. Click + Container
  4. Fill in:
    • Name: cost-exports
    • Public access level: Private
  5. Click Create

Step 3: Configure Cost Management Export

Prerequisites (Account Type Specific):

For PAYG Accounts:

  • No special prerequisites

For MCA Accounts:

  • ⚠️ "Azure charges" setting must be enabled
  • Go to Cost Management + Billing → Billing account properties
  • Verify "Azure charges" is set to "Yes"

For EA Accounts:

  • ⚠️ Enterprise Admin must enable "Account Owner (AO) view charges"
  • Contact your Enterprise Admin if not enabled

Configure Export:

  1. Go to Cost Management + Billing
  2. Select your subscription (or billing account for MCA/EA)
  3. Click Exports under "Cost Management" in left menu
  4. Click + Add
  5. Fill in the configuration:
    • Export name: cloudyali-daily-costs
    • Export type: Daily export of month-to-date costs
    • Start date: Today
    • Storage account: Select the storage account you created
    • Container: cost-exports
    • Directory: cloudyali (optional but recommended)
    • File format: CSV
    • Compression: Gzip (optional but recommended)
  6. Click Create
  1. Click the export you just created
  2. Click Run now
  3. This generates the first export immediately (instead of waiting until tomorrow)

Step 4: Grant Storage Access to Service Principal

Now you need to give your Service Principal permission to read the exported files from storage.

Using Azure Portal:

  1. Go to the storage account
  2. Click Access Control (IAM)
  3. Click + AddAdd role assignment
  4. Select Storage Blob Data Reader role
  5. Under "Assign access to", select User, group, or service principal
  6. Search for CloudYali-Billing (your service principal name)
  7. Select it and click Review + assign

Using Azure CLI:

STORAGE_ACCOUNT_NAME="cloudyalicosts{yourname}"
RESOURCE_GROUP="cloudyali-exports"
CLIENT_ID="your-service-principal-client-id"

az role assignment create \
--assignee $CLIENT_ID \
--role "Storage Blob Data Reader" \
--scope "/subscriptions/{subscription-id}/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.Storage/storageAccounts/$STORAGE_ACCOUNT_NAME"

Step 5: Save Export Details

Save these details - you'll need them in CloudYali:

  • ✅ Storage Account Name: cloudyalicosts{yourname}
  • ✅ Container Name: cost-exports
  • ✅ Export Name: cloudyali-daily-costs
  • ✅ Directory Path: cloudyali (if specified)

Verify Export is Working

After 24-48 hours, verify that exports are being generated:

  1. Go to Cost Management + Billing
  2. Click Exports
  3. Find your export and check:
    • Status shows recent export timestamps
    • Last run was successful

Optional: Check Files in Storage

  1. Go to your Storage Account
  2. Click Containers
  3. Click cost-exports
  4. You should see folders/files like:
    • cloudyali/ (directory you specified)
    • Dated folders and CSV files inside

Troubleshooting

Issue: "No Export Files Generated After 24 Hours"

Solutions:

  1. Verify Cost Management export is configured and running
  2. Click the export and check the Run now option manually
  3. Check export frequency is set to "Daily"
  4. Verify export path matches what you'll enter in CloudYali
  5. For EA accounts, verify "AO view charges" is enabled by Enterprise Admin

Issue: "Permission Denied Reading Export Files"

Solutions:

  1. Verify Service Principal has Storage Blob Data Reader role
  2. Check storage account name in CloudYali matches Azure exactly
  3. Ensure the Service Principal was assigned the role (may take 5-10 minutes to propagate)
  4. Try using Storage Account Contributor role as alternative (more permissive)

Issue: "Export Path Not Found"

Solutions:

  1. Verify the directory path you specified in the export matches CloudYali configuration
  2. Files may not appear for 24-48 hours after export creation
  3. Run the export manually using "Run now" to generate initial files

Cost of Exports

Estimated Monthly Cost: $0.50 - $2.00

This covers:

  • Storage account costs for hosting export files
  • Blob storage read operations (when CloudYali accesses files)
  • No additional data transfer costs (internal Azure transfer)

Next Steps

Once exports are configured:

  1. ✅ Storage account created
  2. ✅ Cost export configured with daily schedule
  3. ✅ Service Principal has access to storage
  4. ➡️ Continue to Adding Account to CloudYali

Remember:

  • Initial data becomes available within 24 hours
  • Full data sync may take 24-48 hours
  • Anomaly detection becomes active after 7+ days of data