Redigera

Dela via


Use the Microsoft Graph API to export partner billing data

Note

This API is available for Cloud Solution Provider (CSP) partners only to access their billed and unbilled reconciliation data for a tenant. To learn more about the CSP program, see Microsoft Cloud Solution Provider.

As part of the Microsoft Partner Center ecosystem, Microsoft direct partners in the Cloud Solution Provider programs can request to export their billed and unbilled data to Azure Blob Storage asynchronously. This removes the need to maintain an open connection for hours and loop through millions of transactions iteratively. The asynchronous API provides a way to quickly access billing and reconciliation data in manageable chunks.

The partner billing API is defined in the OData subnamespace microsoft.graph.partners.billing.

Note

Daily-rated usage normally takes 24 hours to appear in the Microsoft Partner Center or to be available through the API.

Authorization

To export reconciliation data, the calling principal must be in the partner tenant and be granted the appropriate partner billing privilege permissions. The partner billing API supports the following partner permissions.

Permission type Least privileged permission Higher privileged permissions
Delegated (work or school account) PartnerBilling.Read.All Not supported.
Delegated (personal Microsoft account) Not supported. Not supported.
Application PartnerBilling.Read.All Not supported.

Zero Trust

This feature helps organizations to align their identities with the three guiding principles of a Zero Trust architecture:

  • Verify explicitly
  • Use least privilege
  • Assume breach

To find out more about Zero Trust and other ways to align your organization to the guiding principles, see the Zero Trust Guidance Center.

Common use cases

The partner billing API provides methods and actions that allow Microsoft direct partners to export their high-volume billed reconciliation data and billed and unbilled Azure usage data.

Billed usage data

Use case API
Create a new export operation to export billed usage data billedUsage: export
Poll for operation status update Get operation

Unbilled usage data

Use case API
Create a new export operation to export unbilled usage data unbilledUsage: export
Poll for operation status update Get operation

Billed invoice reconciliation data

Use case API
Create a new export operation to export billed invoice reconciliation data billedReconciliation: export
Poll for operation status update Get operation

Asynchronous data retrieval

The download of usage or reconciliation data is a long-running operation that consists of the following operations.

Usage line-item endpoint

Use the billedUsage: export or unbilledUsage: export API to access billed or unbilled consumption line items. The API returns a 202 Accepted response code and a Location header that contains the URL to the long-running operation. You can check the status of the long-running operation by making a GET request at regular intervals until you receive a success status with a manifest URL.

Non-usage line-item endpoint

Use the billedReconciliation: export API to access billed invoice reconciliation line items. The API returns a 202 Accepted response code and a Location header that contains the URL to the long-running operation. You can check the status of the long-running operation by making a GET request at regular intervals until you receive a success status with a manifest URL.

Operation status endpoint

Until you receive the success status, keep polling the Get operation API at regular intervals. If the requested data is unavailable, the API response includes a Retry-After header that indicates how long you should wait before sending another request. When the operation has completed successfully, the response also provides a manifest with details of the generated files. The manifest provides a storage folder from which actual billing data can be downloaded. The response splits or partitions the files to optimize throughput and I/O parallelism.