Jaa


Configure scopes

Connect FinOps hubs to your billing accounts and subscriptions by configuring Cost Management exports manually or granting FinOps hubs access to manage exports for you.

FinOps hubs use Cost Management exports to import cost data for the billing accounts and subscriptions you want to monitor. You can either configure Cost Management exports manually or grant FinOps hubs access to manage exports for you.

Important

Microsoft Cost Management does not support managed exports for Microsoft Customer Agreement billing accounts. For more information, see configure Cost Management exports manually.

For the most seamless experience, we recommend allowing FinOps hubs to manage exports for you when possible. This option requires the least effort to maintain over time.


Configure exports manually

If you can't grant permissions for your scope, you can create Cost Management exports manually to accomplish the same goal.

  1. Create a new FOCUS cost export using the following settings:

    • Type of data = Cost and usage details (FOCUS)¹
    • Dataset version = 1.0 or 1.0r2²
    • Frequency = Daily export of month-to-date costs³
    • Storage account = (Use subscription/resource deployed with your hub)
    • Container = msexports
    • Format = Parquet (when available)
    • Compression Type = Snappy (when available)
    • Directory = (Specify a unique path for this scope⁵)
      • EA billing account: billingAccounts/{enrollment-number}
      • MCA billing profile: billingProfiles/{billing-profile-id}
      • Subscription: subscriptions/{subscription-id}
      • Resource group: subscriptions/{subscription-id}/resourceGroups/{rg-name}
    • File partitioning = On
    • Overwrite data = Off⁴
  2. Create another export with the same settings except set Frequency to Monthly export of last month's costs.

  3. Create exports for any other data you would like to include in your reports.

    • Supported datasets and versions:
      • Price sheet 2023-05-01
        • Required to populate missing prices/costs and calculate savings when using Azure Data Explorer.
      • Reservation details 2023-03-01
      • Reservation recommendations 2023-05-01
        • Virtual machine reservation recommendations are required on the Reservation recommendations page of the Rate optimization report. If you do not create an export, the page will be empty.
      • Reservation transactions 2023-05-01
    • Supported formats: Parquet (preferred) or CSV
    • Supported compression: Snappy (preferred), GZip, or uncompressed
  4. To initialize the dataset, run your exports.

    • Exports can take up to a day to show up after first created.
    • Use the Run now command at the top of the Cost Management Exports page.
    • Your data should be available within 15 minutes or so, depending on how large your account is.
    • If you want to backfill data, open the export details and select the Export selected dates command to export one month at a time or use the Start-FinOpsCostExport PowerShell command to export a larger date range.
  5. Repeat steps 1-4 for each scope you want to monitor.

¹ FinOps hubs 0.2 and later requires FOCUS cost data. As of July 2024, the option to export FOCUS cost data is only accessible from the central Cost Management experience in the Azure portal. If you don't see this option, search for or navigate to Cost Management Exports.

² The only difference in FOCUS 1.0r2 compared to 1.0 is the inclusion of seconds in date columns. If seconds are not required for the system you are ingested data into, there is no need to change existing 1.0 exports to leverage 1.0r2.

³ Configuring a daily export starts in the current month. If you want to backfill historical data, create a one-time export and set the start/end dates to the desired date range.

⁴ While most settings are required, overwriting is optional. We recommend not overwriting files so you can monitor your ingestion pipeline using the Data ingestion report. If you don't plan to use that report, enable overwriting.

⁵ Export paths can be any value but must be unique per scope. We recommended using a path that identifies the source scope, for example, subscription or billing account. If two scopes share the same path, there could be ingestion errors.


Configure managed exports

Managed exports allow FinOps hubs to set up and maintain Cost Management exports for you. To enable managed exports, you must grant Azure Data Factory access to read data across each scope you want to monitor.

Diagram showing the supported scopes for hubs.

Note

Managed exports are only available in FinOps hubs 0.4 and later.

Managed exports use a managed identity (MI) to configure the exports automatically. To set it up, use the following steps:

  1. Grant access to Azure Data Factory.

  2. Add the desired scopes.

    1. From the FinOps hub resource group, open the storage account and navigate to Storage browser > Blob containers > config.
    2. Select the settings.json file, then select > View/edit to open the file.
    3. Update the scopes property to include the scopes you want to monitor. For more information, see Settings.json scope examples.
    4. Select the Save command to save your changes. FinOps hubs should process the change within a few minutes and data should be available within 30 minutes or so, depending on the size of your account.

    Important

    Do not add duplicate or overlapping scopes as this will lead to duplication of data.

  3. Backfill historical data.

    As soon as you configure a new scope, FinOps hubs will start to monitor current and future costs. To backfill historical data, you must run the config_RunBackfillJob pipeline for each month.

    To run the pipeline from the Azure portal:

    1. From the FinOps hub resource group, open the Data Factory instance, select Launch Studio, and navigate to Author > Pipelines > config_RunBackfillJob.
    2. Select Debug in the command bar to run the pipeline. The total run time varies depending on the retention period and number of scopes you're monitoring.

    To run the pipeline from PowerShell:

    Get-AzDataFactoryV2 `
      -ResourceGroupName "{hub-resource-group}" `
      -ErrorAction SilentlyContinue `
    | ForEach-Object {
        Invoke-AzDataFactoryV2Pipeline `
          -ResourceGroupName $_.ResourceGroupName `
          -DataFactoryName $_.DataFactoryName `
          -PipelineName 'config_RunBackfillJob'
    }
    

Settings.json scope examples

  • EA billing account

    "scopes": [
      {
        "scope": "/providers/Microsoft.Billing/billingAccounts/1234567"
      }
    ]
    
  • EA department

    "scopes": [
      {
        "scope": "/providers/Microsoft.Billing/billingAccounts/1234567/departments/56789"
      }
    ]
    
  • Subscription

    "scopes": [
      {
        "scope": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e"
      }
    ]
    
  • Multiple subscriptions

    "scopes": [
      {
        "scope": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e"
      },
      {
        "scope": "subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f"
      }
    ]
    
  • Resource group

    "scopes": [
      {
        "scope": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/ftk-finops-hub"
      }
    ]
    

Configure exports via PowerShell

If it's the first time you're using the FinOps toolkit PowerShell module, refer to the PowerShell deployment guide to install the module.

  1. Install the FinOps toolkit PowerShell module.

    Import-Module -Name FinOpsToolkit
    
  2. Create the export and run it now to backfill up to 12 months of data.

    New-FinOpsCostExport -Name 'ftk-FinOpsHub-costs' `
      -Scope "{scope-id}" `
      -StorageAccountId "{storage-resource-id}" `
      -Backfill 12 `
      -Execute