Exports - Get

The operation to get the export for the defined scope by export name.

GET https://management.azure.com/{scope}/providers/Microsoft.CostManagement/exports/{exportName}?api-version=2023-11-01
GET https://management.azure.com/{scope}/providers/Microsoft.CostManagement/exports/{exportName}?api-version=2023-11-01&$expand={$expand}

URI Parameters

Name In Required Type Description
exportName
path True

string

Export Name.

scope
path True

string

The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.

api-version
query True

string

The API version to use for this operation.

$expand
query

string

May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export.

Responses

Name Type Description
200 OK

Export

OK. The request has succeeded.

Other Status Codes

ErrorResponse

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

ExportGetByBillingAccount
ExportGetByDepartment
ExportGetByEnrollmentAccount
ExportGetByManagementGroup
ExportGetByResourceGroup
ExportGetBySubscription

ExportGetByBillingAccount

Sample request

GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.CostManagement/exports/TestExport?api-version=2023-11-01

Sample response

{
  "id": "providers/Microsoft.Billing/billingAccounts/{billingAccount-Id}/providers/Microsoft.CostManagement/exports/TestExport",
  "name": "TestExport",
  "type": "Microsoft.CostManagement/exports",
  "identity": {
    "type": "SystemAssigned",
    "principalId": "00000000-0000-0000-0000-000000000000",
    "tenantId": "00000000-0000-0000-0000-000000000000"
  },
  "location": "centralus",
  "properties": {
    "format": "Csv",
    "deliveryInfo": {
      "destination": {
        "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182",
        "container": "exports",
        "rootFolderPath": "ad-hoc"
      }
    },
    "definition": {
      "type": "ActualCost",
      "timeframe": "Custom",
      "timePeriod": {
        "from": "2020-05-01T00:00:00Z",
        "to": "2020-05-31T00:00:00Z"
      },
      "dataSet": {
        "granularity": "Daily",
        "configuration": {
          "columns": [
            "Date",
            "MeterId",
            "ResourceId",
            "ResourceLocation",
            "Quantity"
          ]
        }
      }
    }
  }
}

ExportGetByDepartment

Sample request

GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/TestExport?api-version=2023-11-01

Sample response

{
  "id": "providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/TestExport",
  "name": "TestExport",
  "type": "Microsoft.CostManagement/exports",
  "identity": {
    "type": "SystemAssigned",
    "principalId": "00000000-0000-0000-0000-000000000000",
    "tenantId": "00000000-0000-0000-0000-000000000000"
  },
  "location": "centralus",
  "properties": {
    "format": "Csv",
    "deliveryInfo": {
      "destination": {
        "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182",
        "container": "exports",
        "rootFolderPath": "ad-hoc"
      }
    },
    "definition": {
      "type": "ActualCost",
      "timeframe": "Custom",
      "timePeriod": {
        "from": "2020-06-01T00:00:00Z",
        "to": "2020-06-30T00:00:00Z"
      },
      "dataSet": {
        "granularity": "Daily",
        "configuration": {
          "columns": [
            "Date",
            "MeterId",
            "ResourceId",
            "ResourceLocation",
            "Quantity"
          ]
        }
      }
    }
  }
}

ExportGetByEnrollmentAccount

Sample request

GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/TestExport?api-version=2023-11-01

Sample response

{
  "id": "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/TestExport",
  "name": "TestExport",
  "type": "Microsoft.CostManagement/exports",
  "identity": {
    "type": "SystemAssigned",
    "principalId": "00000000-0000-0000-0000-000000000000",
    "tenantId": "00000000-0000-0000-0000-000000000000"
  },
  "location": "centralus",
  "properties": {
    "format": "Csv",
    "deliveryInfo": {
      "destination": {
        "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182",
        "container": "exports",
        "rootFolderPath": "ad-hoc"
      }
    },
    "definition": {
      "type": "ActualCost",
      "timeframe": "Custom",
      "timePeriod": {
        "from": "2019-09-01T00:00:00Z",
        "to": "2019-10-31T00:00:00Z"
      },
      "dataSet": {
        "granularity": "Daily",
        "configuration": {
          "columns": [
            "Date",
            "MeterId",
            "ResourceId",
            "ResourceLocation",
            "Quantity"
          ]
        }
      }
    }
  }
}

ExportGetByManagementGroup

Sample request

GET https://management.azure.com/providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport?api-version=2023-11-01

Sample response

{
  "id": "providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport",
  "name": "TestExport",
  "type": "Microsoft.CostManagement/exports",
  "identity": {
    "type": "SystemAssigned",
    "principalId": "00000000-0000-0000-0000-000000000000",
    "tenantId": "00000000-0000-0000-0000-000000000000"
  },
  "location": "centralus",
  "properties": {
    "format": "Csv",
    "deliveryInfo": {
      "destination": {
        "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182",
        "container": "exports",
        "rootFolderPath": "ad-hoc"
      }
    },
    "definition": {
      "type": "ActualCost",
      "timeframe": "Custom",
      "timePeriod": {
        "from": "2019-09-01T00:00:00Z",
        "to": "2020-10-31T00:00:00Z"
      },
      "dataSet": {
        "granularity": "Daily",
        "configuration": {
          "columns": [
            "UsageDate",
            "MeterId",
            "InstanceId",
            "ResourceLocation",
            "UsageQuantity"
          ]
        }
      }
    }
  }
}

ExportGetByResourceGroup

Sample request

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/TestExport?api-version=2023-11-01

Sample response

{
  "id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/TestExport",
  "name": "TestExport",
  "type": "Microsoft.CostManagement/exports",
  "identity": {
    "type": "SystemAssigned",
    "principalId": "00000000-0000-0000-0000-000000000000",
    "tenantId": "00000000-0000-0000-0000-000000000000"
  },
  "location": "centralus",
  "properties": {
    "format": "Csv",
    "deliveryInfo": {
      "destination": {
        "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182",
        "container": "exports",
        "rootFolderPath": "ad-hoc"
      }
    },
    "definition": {
      "type": "ActualCost",
      "timeframe": "Custom",
      "timePeriod": {
        "from": "2020-06-01T00:00:00Z",
        "to": "2020-06-30T00:00:00Z"
      },
      "dataSet": {
        "granularity": "Daily",
        "configuration": {
          "columns": [
            "Date",
            "MeterId",
            "ResourceId",
            "ResourceLocation",
            "Quantity"
          ]
        }
      }
    }
  }
}

ExportGetBySubscription

Sample request

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/TestExport?api-version=2023-11-01

Sample response

{
  "id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/TestExport",
  "name": "TestExport",
  "type": "Microsoft.CostManagement/exports",
  "identity": {
    "type": "SystemAssigned",
    "principalId": "00000000-0000-0000-0000-000000000000",
    "tenantId": "00000000-0000-0000-0000-000000000000"
  },
  "location": "centralus",
  "properties": {
    "format": "Csv",
    "deliveryInfo": {
      "destination": {
        "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182",
        "container": "exports",
        "rootFolderPath": "ad-hoc"
      }
    },
    "definition": {
      "type": "ActualCost",
      "timeframe": "Custom",
      "timePeriod": {
        "from": "2019-06-01T00:00:00Z",
        "to": "2019-07-31T00:00:00Z"
      },
      "dataSet": {
        "granularity": "Daily",
        "configuration": {
          "columns": [
            "Date",
            "MeterId",
            "ResourceId",
            "ResourceLocation",
            "Quantity"
          ]
        }
      }
    }
  }
}

Definitions

Name Description
CommonExportProperties

The common properties of the export.

ErrorDetails

The details of the error.

ErrorResponse

Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.

Some Error responses:

  • 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header.

  • 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header.

ExecutionStatus

The last known status of the export run.

ExecutionType

The type of the export run.

Export

An export resource.

ExportDataset

The definition for data in the export.

ExportDatasetConfiguration

The export dataset configuration. Allows columns to be selected for the export. If not provided then the export will include all available columns.

ExportDefinition

The definition of an export.

ExportDeliveryDestination

This represents the blob storage account location where exports of costs will be delivered. There are two ways to configure the destination. The approach recommended for most customers is to specify the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports resource provider in order to give Cost Management services access to the storage. When creating an export in the Azure portal this registration is performed automatically but API users may need to register the subscription explicitly (for more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another way to configure the destination is available ONLY to Partners with a Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying the resourceId of a storage account, can specify the storage account name along with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should be created for the blob service with Service/Container/Object resource types and with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key ).

ExportDeliveryInfo

The delivery information associated with a export.

ExportExecutionListResult

Result of listing the run history of an export.

ExportRecurrencePeriod

The start and end date for recurrence schedule.

ExportRun

An export run.

ExportSchedule

The schedule associated with the export.

ExportTimePeriod

The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 3 months.

ExportType

The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations.

FormatType

The format of the export being delivered. Currently only 'Csv' is supported.

GranularityType

The granularity of rows in the export. Currently only 'Daily' is supported.

RecurrenceType

The schedule recurrence.

StatusType

The status of the export's schedule. If 'Inactive', the export's schedule is paused.

SystemAssignedServiceIdentity

Managed service identity (either system assigned, or none)

SystemAssignedServiceIdentityType

Type of managed service identity (either system assigned, or none).

TimeframeType

The time frame for pulling data for the export. If custom, then a specific time period must be provided.

CommonExportProperties

The common properties of the export.

Name Type Description
definition

ExportDefinition

Has the definition for the export.

deliveryInfo

ExportDeliveryInfo

Has delivery information for the export.

format

FormatType

The format of the export being delivered. Currently only 'Csv' is supported.

nextRunTimeEstimate

string

If the export has an active schedule, provides an estimate of the next run time.

partitionData

boolean

If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes.

runHistory

ExportExecutionListResult

If requested, has the most recent run history for the export.

ErrorDetails

The details of the error.

Name Type Description
code

string

Error code.

message

string

Error message indicating why the operation failed.

ErrorResponse

Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.

Some Error responses:

  • 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header.

  • 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header.

Name Type Description
error

ErrorDetails

The details of the error.

ExecutionStatus

The last known status of the export run.

Name Type Description
Completed

string

DataNotAvailable

string

Failed

string

InProgress

string

NewDataNotAvailable

string

Queued

string

Timeout

string

ExecutionType

The type of the export run.

Name Type Description
OnDemand

string

Scheduled

string

Export

An export resource.

Name Type Description
eTag

string

eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.

id

string

Resource Id.

identity

SystemAssignedServiceIdentity

The managed identity associated with Export

location

string

The location of the Export's managed identity. Only required when utilizing managed identity.

name

string

Resource name.

properties.definition

ExportDefinition

Has the definition for the export.

properties.deliveryInfo

ExportDeliveryInfo

Has delivery information for the export.

properties.format

FormatType

The format of the export being delivered. Currently only 'Csv' is supported.

properties.nextRunTimeEstimate

string

If the export has an active schedule, provides an estimate of the next run time.

properties.partitionData

boolean

If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes.

properties.runHistory

ExportExecutionListResult

If requested, has the most recent run history for the export.

properties.schedule

ExportSchedule

Has schedule information for the export.

type

string

Resource type.

ExportDataset

The definition for data in the export.

Name Type Description
configuration

ExportDatasetConfiguration

The export dataset configuration.

granularity

GranularityType

The granularity of rows in the export. Currently only 'Daily' is supported.

ExportDatasetConfiguration

The export dataset configuration. Allows columns to be selected for the export. If not provided then the export will include all available columns.

Name Type Description
columns

string[]

Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel (see examples).

ExportDefinition

The definition of an export.

Name Type Description
dataSet

ExportDataset

The definition for data in the export.

timePeriod

ExportTimePeriod

Has time period for pulling data for the export.

timeframe

TimeframeType

The time frame for pulling data for the export. If custom, then a specific time period must be provided.

type

ExportType

The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations.

ExportDeliveryDestination

This represents the blob storage account location where exports of costs will be delivered. There are two ways to configure the destination. The approach recommended for most customers is to specify the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports resource provider in order to give Cost Management services access to the storage. When creating an export in the Azure portal this registration is performed automatically but API users may need to register the subscription explicitly (for more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another way to configure the destination is available ONLY to Partners with a Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying the resourceId of a storage account, can specify the storage account name along with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should be created for the blob service with Service/Container/Object resource types and with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key ).

Name Type Description
container

string

The name of the container where exports will be uploaded. If the container does not exist it will be created.

resourceId

string

The resource id of the storage account where exports will be delivered. This is not required if a sasToken and storageAccount are specified.

rootFolderPath

string

The name of the directory where exports will be uploaded.

sasToken

string

A SAS token for the storage account. For a restricted set of Azure customers this together with storageAccount can be specified instead of resourceId. Note: the value returned by the API for this property will always be obfuscated. Returning this same obfuscated value will not result in the SAS token being updated. To update this value a new SAS token must be specified.

storageAccount

string

The storage account where exports will be uploaded. For a restricted set of Azure customers this together with sasToken can be specified instead of resourceId.

ExportDeliveryInfo

The delivery information associated with a export.

Name Type Description
destination

ExportDeliveryDestination

Has destination for the export being delivered.

ExportExecutionListResult

Result of listing the run history of an export.

Name Type Description
value

ExportRun[]

A list of export runs.

ExportRecurrencePeriod

The start and end date for recurrence schedule.

Name Type Description
from

string

The start date of recurrence.

to

string

The end date of recurrence.

ExportRun

An export run.

Name Type Description
eTag

string

eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.

id

string

Resource Id.

name

string

Resource name.

properties.error

ErrorDetails

The details of any error.

properties.executionType

ExecutionType

The type of the export run.

properties.fileName

string

The name of the exported file.

properties.processingEndTime

string

The time when the export run finished.

properties.processingStartTime

string

The time when export was picked up to be run.

properties.runSettings

CommonExportProperties

The export settings that were in effect for this run.

properties.status

ExecutionStatus

The last known status of the export run.

properties.submittedBy

string

The identifier for the entity that triggered the export. For on-demand runs it is the user email. For scheduled runs it is 'System'.

properties.submittedTime

string

The time when export was queued to be run.

type

string

Resource type.

ExportSchedule

The schedule associated with the export.

Name Type Description
recurrence

RecurrenceType

The schedule recurrence.

recurrencePeriod

ExportRecurrencePeriod

Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than start date.

status

StatusType

The status of the export's schedule. If 'Inactive', the export's schedule is paused.

ExportTimePeriod

The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 3 months.

Name Type Description
from

string

The start date for export data.

to

string

The end date for export data.

ExportType

The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations.

Name Type Description
ActualCost

string

AmortizedCost

string

Usage

string

FormatType

The format of the export being delivered. Currently only 'Csv' is supported.

Name Type Description
Csv

string

GranularityType

The granularity of rows in the export. Currently only 'Daily' is supported.

Name Type Description
Daily

string

RecurrenceType

The schedule recurrence.

Name Type Description
Annually

string

Daily

string

Monthly

string

Weekly

string

StatusType

The status of the export's schedule. If 'Inactive', the export's schedule is paused.

Name Type Description
Active

string

Inactive

string

SystemAssignedServiceIdentity

Managed service identity (either system assigned, or none)

Name Type Description
principalId

string

The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity.

tenantId

string

The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity.

type

SystemAssignedServiceIdentityType

Type of managed service identity (either system assigned, or none).

SystemAssignedServiceIdentityType

Type of managed service identity (either system assigned, or none).

Name Type Description
None

string

SystemAssigned

string

TimeframeType

The time frame for pulling data for the export. If custom, then a specific time period must be provided.

Name Type Description
BillingMonthToDate

string

Custom

string

MonthToDate

string

TheLastBillingMonth

string

TheLastMonth

string

WeekToDate

string