Esta API es el reemplazo de todas las API de detalles de uso publicadas anteriormente. Solicite generar un informe de detalles de costos para el intervalo de fechas proporcionado, el período de facturación (solo clientes empresariales) o el identificador de facturación de forma asincrónica en un ámbito determinado. La llamada inicial para solicitar un informe devolverá un 202 con un encabezado "Location" y "Retry-After". El encabezado "Ubicación" proporcionará el punto de conexión para sondear para obtener el resultado de la generación de informes. "Retry-After" proporciona la duración que se debe esperar antes de sondear el informe generado. Una llamada para sondear la operación de informe proporcionará una respuesta 202 con un encabezado "Ubicación" si la operación todavía está en curso. Una vez completada la operación de generación de informes, el punto de conexión de sondeo proporcionará una respuesta 200 junto con detalles sobre los blobs de informe que están disponibles para su descarga. Los detalles sobre los archivos disponibles para su descarga estarán disponibles en el cuerpo de la respuesta de sondeo. Para comprender los detalles de costos (anteriormente conocidos como detalles de uso) que se encuentran en los archivos , consulte https://mms.heiai.top/en-us/azure/cost-management-billing/automate/understand-usage-details-fields
POST https://management.azure.com/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2025-03-01
Parámetros de identificador URI
| Nombre |
En |
Requerido |
Tipo |
Description |
|
scope
|
path |
True
|
string
|
El identificador de recurso de ARM para la suscripción, la cuenta de facturación u otros ámbitos de facturación. Actualmente no se admiten grupos de recursos y grupos de administración. Para obtener más información, consulte https://aka.ms/costmgmt/scopes.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Versión de la API que se va a usar para esta operación.
|
Cuerpo de la solicitud
| Nombre |
Tipo |
Description |
|
billingPeriod
|
string
|
Los clientes del Contrato Enterprise solo pueden usar este parámetro. Use el formato YearMonth(por ejemplo, 202008). Este parámetro no se puede usar junto con los parámetros invoiceId o timePeriod. Si no se proporciona un parámetro timePeriod, invoiceId o billingPeriod en el cuerpo de la solicitud, la API devolverá el costo del mes actual.
|
|
invoiceId
|
string
|
Los clientes del Contrato de cliente de Microsoft solo pueden usar este parámetro. Además, solo se puede usar en el ámbito perfil de facturación o cliente. Este parámetro no se puede usar junto con los parámetros billingPeriod o timePeriod. Si no se proporciona un parámetro timePeriod, invoiceId o billingPeriod en el cuerpo de la solicitud, la API devolverá el costo del mes actual.
|
|
metric
|
CostDetailsMetricType
|
Tipo del informe detallado. De forma predeterminada, se proporciona ActualCost
|
|
timePeriod
|
CostDetailsTimePeriod
|
Intervalo de fechas específico de los detalles de costo solicitados para el informe. Este parámetro no se puede usar junto con los parámetros invoiceId o billingPeriod. Si no se proporciona un parámetro timePeriod, invoiceId o billingPeriod en el cuerpo de la solicitud, la API devolverá el costo del mes actual. La API solo permite extraer datos durante 1 mes o menos y no más de 13 meses. Si no se proporciona timePeriod o billingPeriod o invoiceId, la API tiene como valor predeterminado el período de tiempo del mes abierto.
|
Respuestas
| Nombre |
Tipo |
Description |
|
200 OK
|
CostDetailsOperationResults
|
La operación de Azure se completó correctamente.
|
|
202 Accepted
|
|
Operación de recurso aceptada.
Encabezados
Location: string
|
|
204 No Content
|
|
No hay contenido que enviar para esta solicitud, pero los encabezados pueden ser útiles.
|
|
Other Status Codes
|
GenerateCostDetailsReportErrorResponse
|
Una respuesta de error inesperada.
|
Seguridad
azure_auth
Flujo de OAuth2 de Azure Active Directory.
Tipo:
oauth2
Flujo:
implicit
Dirección URL de autorización:
https://login.microsoftonline.com/common/oauth2/authorize
Ámbitos
| Nombre |
Description |
|
user_impersonation
|
suplantar la cuenta de usuario
|
Ejemplos
GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod
Solicitud de ejemplo
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2025-03-01
{
"billingPeriod": "202205",
"metric": "ActualCost"
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.costmanagement import CostManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-costmanagement
# USAGE
python generate_cost_details_report_by_billing_account_enterprise_agreement_customer_and_billing_period.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CostManagementClient(
credential=DefaultAzureCredential(),
)
response = client.generate_cost_details_report.begin_create_operation(
scope="providers/Microsoft.Billing/billingAccounts/12345",
parameters={"billingPeriod": "202205", "metric": "ActualCost"},
).result()
print(response)
# x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcostmanagement_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement/v3"
)
// Generated from example definition: 2025-03-01/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json
func ExampleGenerateCostDetailsReportClient_BeginCreateOperation_generateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewGenerateCostDetailsReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/billingAccounts/12345", armcostmanagement.GenerateCostDetailsReportRequestDefinition{
BillingPeriod: to.Ptr("202205"),
Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcostmanagement.GenerateCostDetailsReportClientCreateOperationResponse{
// CostDetailsOperationResults: armcostmanagement.CostDetailsOperationResults{
// Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000"),
// Manifest: &armcostmanagement.ReportManifest{
// BlobCount: to.Ptr[int32](1),
// Blobs: []*armcostmanagement.BlobInfo{
// {
// BlobLink: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
// ByteCount: to.Ptr[int64](32741),
// },
// },
// ByteCount: to.Ptr[int64](32741),
// CompressData: to.Ptr(false),
// DataFormat: to.Ptr(armcostmanagement.CostDetailsDataFormatCSVCostDetailsDataFormat),
// ManifestVersion: to.Ptr("2025-03-01"),
// RequestContext: &armcostmanagement.RequestContext{
// RequestBody: &armcostmanagement.GenerateCostDetailsReportRequestDefinition{
// BillingPeriod: to.Ptr("202205"),
// Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
// },
// RequestScope: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345"),
// },
// },
// Status: to.Ptr(armcostmanagement.CostDetailsStatusTypeCompletedCostDetailsStatusType),
// ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-10T08:08:46.1973252Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CostManagementClient } = require("@azure/arm-costmanagement");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
*
* @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
* x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json
*/
async function generateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod() {
const credential = new DefaultAzureCredential();
const client = new CostManagementClient(credential);
const result = await client.generateCostDetailsReport.createOperation(
"providers/Microsoft.Billing/billingAccounts/12345",
{ billingPeriod: "202205", metric: "ActualCost" },
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Respuesta de muestra
{
"name": "00000000-0000-0000-0000-000000000000",
"id": "/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000",
"manifest": {
"blobCount": 1,
"blobs": [
{
"blobLink": "https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd",
"byteCount": 32741
}
],
"byteCount": 32741,
"compressData": false,
"dataFormat": "Csv",
"manifestVersion": "2025-03-01",
"requestContext": {
"requestBody": {
"billingPeriod": "202205",
"metric": "ActualCost"
},
"requestScope": "providers/Microsoft.Billing/billingAccounts/12345"
}
},
"status": "Completed",
"validTill": "2022-05-10T08:08:46.1973252Z"
}
Location: https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000?api-version=2025-03-01
Retry-After: 60
GenerateCostDetailsReportByBillingProfileAndInvoiceId
Solicitud de ejemplo
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2025-03-01
{
"invoiceId": "M1234567",
"metric": "ActualCost"
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.costmanagement import CostManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-costmanagement
# USAGE
python generate_cost_details_report_by_billing_profile_and_invoice_id.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CostManagementClient(
credential=DefaultAzureCredential(),
)
response = client.generate_cost_details_report.begin_create_operation(
scope="providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579",
parameters={"invoiceId": "M1234567", "metric": "ActualCost"},
).result()
print(response)
# x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingProfileAndInvoiceId.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcostmanagement_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement/v3"
)
// Generated from example definition: 2025-03-01/GenerateCostDetailsReportByBillingProfileAndInvoiceId.json
func ExampleGenerateCostDetailsReportClient_BeginCreateOperation_generateCostDetailsReportByBillingProfileAndInvoiceId() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewGenerateCostDetailsReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.GenerateCostDetailsReportRequestDefinition{
InvoiceID: to.Ptr("M1234567"),
Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcostmanagement.GenerateCostDetailsReportClientCreateOperationResponse{
// CostDetailsOperationResults: armcostmanagement.CostDetailsOperationResults{
// Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000"),
// Manifest: &armcostmanagement.ReportManifest{
// BlobCount: to.Ptr[int32](1),
// Blobs: []*armcostmanagement.BlobInfo{
// {
// BlobLink: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
// ByteCount: to.Ptr[int64](32741),
// },
// },
// ByteCount: to.Ptr[int64](32741),
// CompressData: to.Ptr(false),
// DataFormat: to.Ptr(armcostmanagement.CostDetailsDataFormatCSVCostDetailsDataFormat),
// ManifestVersion: to.Ptr("2025-03-01"),
// RequestContext: &armcostmanagement.RequestContext{
// RequestBody: &armcostmanagement.GenerateCostDetailsReportRequestDefinition{
// BillingPeriod: to.Ptr("202205"),
// Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
// },
// RequestScope: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"),
// },
// },
// Status: to.Ptr(armcostmanagement.CostDetailsStatusTypeCompletedCostDetailsStatusType),
// ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-10T08:08:46.1973252Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CostManagementClient } = require("@azure/arm-costmanagement");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
*
* @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
* x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingProfileAndInvoiceId.json
*/
async function generateCostDetailsReportByBillingProfileAndInvoiceId() {
const credential = new DefaultAzureCredential();
const client = new CostManagementClient(credential);
const result = await client.generateCostDetailsReport.createOperation(
"providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579",
{ invoiceId: "M1234567", metric: "ActualCost" },
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Respuesta de muestra
{
"name": "00000000-0000-0000-0000-000000000000",
"id": "/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000",
"manifest": {
"blobCount": 1,
"blobs": [
{
"blobLink": "https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd",
"byteCount": 32741
}
],
"byteCount": 32741,
"compressData": false,
"dataFormat": "Csv",
"manifestVersion": "2025-03-01",
"requestContext": {
"requestBody": {
"billingPeriod": "202205",
"metric": "ActualCost"
},
"requestScope": "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"
}
},
"status": "Completed",
"validTill": "2022-05-10T08:08:46.1973252Z"
}
Location: https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000?api-version=2025-03-01
Retry-After: 60
GenerateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId
Solicitud de ejemplo
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2025-03-01
{
"invoiceId": "M1234567",
"metric": "ActualCost"
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.costmanagement import CostManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-costmanagement
# USAGE
python generate_cost_details_report_by_billing_profile_and_invoice_id_and_customer_id.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CostManagementClient(
credential=DefaultAzureCredential(),
)
response = client.generate_cost_details_report.begin_create_operation(
scope="providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579",
parameters={"invoiceId": "M1234567", "metric": "ActualCost"},
).result()
print(response)
# x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcostmanagement_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement/v3"
)
// Generated from example definition: 2025-03-01/GenerateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId.json
func ExampleGenerateCostDetailsReportClient_BeginCreateOperation_generateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewGenerateCostDetailsReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", armcostmanagement.GenerateCostDetailsReportRequestDefinition{
InvoiceID: to.Ptr("M1234567"),
Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcostmanagement.GenerateCostDetailsReportClientCreateOperationResponse{
// CostDetailsOperationResults: armcostmanagement.CostDetailsOperationResults{
// Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000"),
// Manifest: &armcostmanagement.ReportManifest{
// BlobCount: to.Ptr[int32](1),
// Blobs: []*armcostmanagement.BlobInfo{
// {
// BlobLink: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
// ByteCount: to.Ptr[int64](32741),
// },
// },
// ByteCount: to.Ptr[int64](32741),
// CompressData: to.Ptr(false),
// DataFormat: to.Ptr(armcostmanagement.CostDetailsDataFormatCSVCostDetailsDataFormat),
// ManifestVersion: to.Ptr("2025-03-01"),
// RequestContext: &armcostmanagement.RequestContext{
// RequestBody: &armcostmanagement.GenerateCostDetailsReportRequestDefinition{
// BillingPeriod: to.Ptr("202205"),
// Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
// },
// RequestScope: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"),
// },
// },
// Status: to.Ptr(armcostmanagement.CostDetailsStatusTypeCompletedCostDetailsStatusType),
// ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-10T08:08:46.1973252Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CostManagementClient } = require("@azure/arm-costmanagement");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
*
* @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
* x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId.json
*/
async function generateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId() {
const credential = new DefaultAzureCredential();
const client = new CostManagementClient(credential);
const result = await client.generateCostDetailsReport.createOperation(
"providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579",
{ invoiceId: "M1234567", metric: "ActualCost" },
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Respuesta de muestra
{
"name": "00000000-0000-0000-0000-000000000000",
"id": "/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000",
"manifest": {
"blobCount": 1,
"blobs": [
{
"blobLink": "https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd",
"byteCount": 32741
}
],
"byteCount": 32741,
"compressData": false,
"dataFormat": "Csv",
"manifestVersion": "2025-03-01",
"requestContext": {
"requestBody": {
"billingPeriod": "202205",
"metric": "ActualCost"
},
"requestScope": "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"
}
},
"status": "Completed",
"validTill": "2022-05-10T08:08:46.1973252Z"
}
Location: https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000?api-version=2025-03-01
Retry-After: 60
GenerateCostDetailsReportByCustomerAndTimePeriod
Solicitud de ejemplo
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2025-03-01
{
"metric": "ActualCost",
"timePeriod": {
"end": "2020-03-15",
"start": "2020-03-01"
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.costmanagement import CostManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-costmanagement
# USAGE
python generate_cost_details_report_by_customer_and_time_period.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CostManagementClient(
credential=DefaultAzureCredential(),
)
response = client.generate_cost_details_report.begin_create_operation(
scope="providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579",
parameters={"metric": "ActualCost", "timePeriod": {"end": "2020-03-15", "start": "2020-03-01"}},
).result()
print(response)
# x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByCustomerAndTimePeriod.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcostmanagement_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement/v3"
)
// Generated from example definition: 2025-03-01/GenerateCostDetailsReportByCustomerAndTimePeriod.json
func ExampleGenerateCostDetailsReportClient_BeginCreateOperation_generateCostDetailsReportByCustomerAndTimePeriod() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewGenerateCostDetailsReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", armcostmanagement.GenerateCostDetailsReportRequestDefinition{
Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
TimePeriod: &armcostmanagement.CostDetailsTimePeriod{
End: to.Ptr("2020-03-15"),
Start: to.Ptr("2020-03-01"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcostmanagement.GenerateCostDetailsReportClientCreateOperationResponse{
// CostDetailsOperationResults: armcostmanagement.CostDetailsOperationResults{
// Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000"),
// Manifest: &armcostmanagement.ReportManifest{
// BlobCount: to.Ptr[int32](1),
// Blobs: []*armcostmanagement.BlobInfo{
// {
// BlobLink: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
// ByteCount: to.Ptr[int64](32741),
// },
// },
// ByteCount: to.Ptr[int64](32741),
// CompressData: to.Ptr(false),
// DataFormat: to.Ptr(armcostmanagement.CostDetailsDataFormatCSVCostDetailsDataFormat),
// ManifestVersion: to.Ptr("2025-03-01"),
// RequestContext: &armcostmanagement.RequestContext{
// RequestBody: &armcostmanagement.GenerateCostDetailsReportRequestDefinition{
// Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
// TimePeriod: &armcostmanagement.CostDetailsTimePeriod{
// End: to.Ptr("2020-03-15"),
// Start: to.Ptr("2020-03-01"),
// },
// },
// RequestScope: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"),
// },
// },
// Status: to.Ptr(armcostmanagement.CostDetailsStatusTypeCompletedCostDetailsStatusType),
// ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-10T08:08:46.1973252Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CostManagementClient } = require("@azure/arm-costmanagement");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
*
* @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
* x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByCustomerAndTimePeriod.json
*/
async function generateCostDetailsReportByCustomerAndTimePeriod() {
const credential = new DefaultAzureCredential();
const client = new CostManagementClient(credential);
const result = await client.generateCostDetailsReport.createOperation(
"providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579",
{ metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } },
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Respuesta de muestra
{
"name": "00000000-0000-0000-0000-000000000000",
"id": "/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000",
"manifest": {
"blobCount": 1,
"blobs": [
{
"blobLink": "https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd",
"byteCount": 32741
}
],
"byteCount": 32741,
"compressData": false,
"dataFormat": "Csv",
"manifestVersion": "2025-03-01",
"requestContext": {
"requestBody": {
"metric": "ActualCost",
"timePeriod": {
"end": "2020-03-15",
"start": "2020-03-01"
}
},
"requestScope": "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"
}
},
"status": "Completed",
"validTill": "2022-05-10T08:08:46.1973252Z"
}
Location: https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000?api-version=2025-03-01
Retry-After: 60
GenerateCostDetailsReportByDepartmentsAndTimePeriod
Solicitud de ejemplo
POST https://management.azure.com/providers/Microsoft.Billing/departments/12345/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2025-03-01
{
"metric": "ActualCost",
"timePeriod": {
"end": "2020-03-15",
"start": "2020-03-01"
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.costmanagement import CostManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-costmanagement
# USAGE
python generate_cost_details_report_by_departments_and_time_period.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CostManagementClient(
credential=DefaultAzureCredential(),
)
response = client.generate_cost_details_report.begin_create_operation(
scope="providers/Microsoft.Billing/departments/12345",
parameters={"metric": "ActualCost", "timePeriod": {"end": "2020-03-15", "start": "2020-03-01"}},
).result()
print(response)
# x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByDepartmentsAndTimePeriod.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcostmanagement_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement/v3"
)
// Generated from example definition: 2025-03-01/GenerateCostDetailsReportByDepartmentsAndTimePeriod.json
func ExampleGenerateCostDetailsReportClient_BeginCreateOperation_generateCostDetailsReportByDepartmentsAndTimePeriod() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewGenerateCostDetailsReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/departments/12345", armcostmanagement.GenerateCostDetailsReportRequestDefinition{
Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
TimePeriod: &armcostmanagement.CostDetailsTimePeriod{
End: to.Ptr("2020-03-15"),
Start: to.Ptr("2020-03-01"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcostmanagement.GenerateCostDetailsReportClientCreateOperationResponse{
// CostDetailsOperationResults: armcostmanagement.CostDetailsOperationResults{
// Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/providers/Microsoft.Billing/departments/12345/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000"),
// Manifest: &armcostmanagement.ReportManifest{
// BlobCount: to.Ptr[int32](1),
// Blobs: []*armcostmanagement.BlobInfo{
// {
// BlobLink: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
// ByteCount: to.Ptr[int64](32741),
// },
// },
// ByteCount: to.Ptr[int64](32741),
// CompressData: to.Ptr(false),
// DataFormat: to.Ptr(armcostmanagement.CostDetailsDataFormatCSVCostDetailsDataFormat),
// ManifestVersion: to.Ptr("2025-03-01"),
// RequestContext: &armcostmanagement.RequestContext{
// RequestBody: &armcostmanagement.GenerateCostDetailsReportRequestDefinition{
// Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
// TimePeriod: &armcostmanagement.CostDetailsTimePeriod{
// End: to.Ptr("2020-03-15"),
// Start: to.Ptr("2020-03-01"),
// },
// },
// RequestScope: to.Ptr("providers/Microsoft.Billing/departments/12345"),
// },
// },
// Status: to.Ptr(armcostmanagement.CostDetailsStatusTypeCompletedCostDetailsStatusType),
// ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-10T08:08:46.1973252Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CostManagementClient } = require("@azure/arm-costmanagement");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
*
* @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
* x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByDepartmentsAndTimePeriod.json
*/
async function generateCostDetailsReportByDepartmentsAndTimePeriod() {
const credential = new DefaultAzureCredential();
const client = new CostManagementClient(credential);
const result = await client.generateCostDetailsReport.createOperation(
"providers/Microsoft.Billing/departments/12345",
{ metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } },
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Respuesta de muestra
{
"name": "00000000-0000-0000-0000-000000000000",
"id": "/providers/Microsoft.Billing/departments/12345/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000",
"manifest": {
"blobCount": 1,
"blobs": [
{
"blobLink": "https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd",
"byteCount": 32741
}
],
"byteCount": 32741,
"compressData": false,
"dataFormat": "Csv",
"manifestVersion": "2025-03-01",
"requestContext": {
"requestBody": {
"metric": "ActualCost",
"timePeriod": {
"end": "2020-03-15",
"start": "2020-03-01"
}
},
"requestScope": "providers/Microsoft.Billing/departments/12345"
}
},
"status": "Completed",
"validTill": "2022-05-10T08:08:46.1973252Z"
}
Location: https://management.azure.com/providers/Microsoft.Billing/departments/12345/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000?api-version=2025-03-01
Retry-After: 60
GenerateCostDetailsReportByEnrollmentAccountsAndTimePeriod
Solicitud de ejemplo
POST https://management.azure.com/providers/Microsoft.Billing/enrollmentAccounts/1234/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2025-03-01
{
"metric": "ActualCost",
"timePeriod": {
"end": "2020-03-15",
"start": "2020-03-01"
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.costmanagement import CostManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-costmanagement
# USAGE
python generate_cost_details_report_by_enrollment_accounts_and_time_period.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CostManagementClient(
credential=DefaultAzureCredential(),
)
response = client.generate_cost_details_report.begin_create_operation(
scope="providers/Microsoft.Billing/enrollmentAccounts/1234",
parameters={"metric": "ActualCost", "timePeriod": {"end": "2020-03-15", "start": "2020-03-01"}},
).result()
print(response)
# x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByEnrollmentAccountsAndTimePeriod.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcostmanagement_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement/v3"
)
// Generated from example definition: 2025-03-01/GenerateCostDetailsReportByEnrollmentAccountsAndTimePeriod.json
func ExampleGenerateCostDetailsReportClient_BeginCreateOperation_generateCostDetailsReportByEnrollmentAccountsAndTimePeriod() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewGenerateCostDetailsReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/enrollmentAccounts/1234", armcostmanagement.GenerateCostDetailsReportRequestDefinition{
Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
TimePeriod: &armcostmanagement.CostDetailsTimePeriod{
End: to.Ptr("2020-03-15"),
Start: to.Ptr("2020-03-01"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcostmanagement.GenerateCostDetailsReportClientCreateOperationResponse{
// CostDetailsOperationResults: armcostmanagement.CostDetailsOperationResults{
// Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/providers/Microsoft.Billing/enrollmentAccounts/1234/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000"),
// Manifest: &armcostmanagement.ReportManifest{
// BlobCount: to.Ptr[int32](1),
// Blobs: []*armcostmanagement.BlobInfo{
// {
// BlobLink: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
// ByteCount: to.Ptr[int64](32741),
// },
// },
// ByteCount: to.Ptr[int64](32741),
// CompressData: to.Ptr(false),
// DataFormat: to.Ptr(armcostmanagement.CostDetailsDataFormatCSVCostDetailsDataFormat),
// ManifestVersion: to.Ptr("2025-03-01"),
// RequestContext: &armcostmanagement.RequestContext{
// RequestBody: &armcostmanagement.GenerateCostDetailsReportRequestDefinition{
// Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
// TimePeriod: &armcostmanagement.CostDetailsTimePeriod{
// End: to.Ptr("2020-03-15"),
// Start: to.Ptr("2020-03-01"),
// },
// },
// RequestScope: to.Ptr("providers/Microsoft.Billing/enrollmentAccounts/1234"),
// },
// },
// Status: to.Ptr(armcostmanagement.CostDetailsStatusTypeCompletedCostDetailsStatusType),
// ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-10T08:08:46.1973252Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CostManagementClient } = require("@azure/arm-costmanagement");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
*
* @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
* x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByEnrollmentAccountsAndTimePeriod.json
*/
async function generateCostDetailsReportByEnrollmentAccountsAndTimePeriod() {
const credential = new DefaultAzureCredential();
const client = new CostManagementClient(credential);
const result = await client.generateCostDetailsReport.createOperation(
"providers/Microsoft.Billing/enrollmentAccounts/1234",
{ metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } },
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Respuesta de muestra
{
"name": "00000000-0000-0000-0000-000000000000",
"id": "/providers/Microsoft.Billing/enrollmentAccounts/1234/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000",
"manifest": {
"blobCount": 1,
"blobs": [
{
"blobLink": "https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd",
"byteCount": 32741
}
],
"byteCount": 32741,
"compressData": false,
"dataFormat": "Csv",
"manifestVersion": "2025-03-01",
"requestContext": {
"requestBody": {
"metric": "ActualCost",
"timePeriod": {
"end": "2020-03-15",
"start": "2020-03-01"
}
},
"requestScope": "providers/Microsoft.Billing/enrollmentAccounts/1234"
}
},
"status": "Completed",
"validTill": "2022-05-10T08:08:46.1973252Z"
}
Location: https://management.azure.com/providers/Microsoft.Billing/enrollmentAccounts/1234/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000?api-version=2025-03-01
Retry-After: 60
GenerateCostDetailsReportBySubscriptionAndTimePeriod
Solicitud de ejemplo
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2025-03-01
{
"metric": "ActualCost",
"timePeriod": {
"end": "2020-03-15",
"start": "2020-03-01"
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.costmanagement import CostManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-costmanagement
# USAGE
python generate_cost_details_report_by_subscription_and_time_period.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CostManagementClient(
credential=DefaultAzureCredential(),
)
response = client.generate_cost_details_report.begin_create_operation(
scope="subscriptions/00000000-0000-0000-0000-000000000000",
parameters={"metric": "ActualCost", "timePeriod": {"end": "2020-03-15", "start": "2020-03-01"}},
).result()
print(response)
# x-ms-original-file: 2025-03-01/GenerateCostDetailsReportBySubscriptionAndTimePeriod.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcostmanagement_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement/v3"
)
// Generated from example definition: 2025-03-01/GenerateCostDetailsReportBySubscriptionAndTimePeriod.json
func ExampleGenerateCostDetailsReportClient_BeginCreateOperation_generateCostDetailsReportBySubscriptionAndTimePeriod() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewGenerateCostDetailsReportClient().BeginCreateOperation(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", armcostmanagement.GenerateCostDetailsReportRequestDefinition{
Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
TimePeriod: &armcostmanagement.CostDetailsTimePeriod{
End: to.Ptr("2020-03-15"),
Start: to.Ptr("2020-03-01"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcostmanagement.GenerateCostDetailsReportClientCreateOperationResponse{
// CostDetailsOperationResults: armcostmanagement.CostDetailsOperationResults{
// Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000"),
// Manifest: &armcostmanagement.ReportManifest{
// BlobCount: to.Ptr[int32](1),
// Blobs: []*armcostmanagement.BlobInfo{
// {
// BlobLink: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
// ByteCount: to.Ptr[int64](32741),
// },
// },
// ByteCount: to.Ptr[int64](32741),
// CompressData: to.Ptr(false),
// DataFormat: to.Ptr(armcostmanagement.CostDetailsDataFormatCSVCostDetailsDataFormat),
// ManifestVersion: to.Ptr("2025-03-01"),
// RequestContext: &armcostmanagement.RequestContext{
// RequestBody: &armcostmanagement.GenerateCostDetailsReportRequestDefinition{
// Metric: to.Ptr(armcostmanagement.CostDetailsMetricTypeActualCostCostDetailsMetricType),
// TimePeriod: &armcostmanagement.CostDetailsTimePeriod{
// End: to.Ptr("2020-03-15"),
// Start: to.Ptr("2020-03-01"),
// },
// },
// RequestScope: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000"),
// },
// },
// Status: to.Ptr(armcostmanagement.CostDetailsStatusTypeCompletedCostDetailsStatusType),
// ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-10T08:08:46.1973252Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CostManagementClient } = require("@azure/arm-costmanagement");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
*
* @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://mms.heiai.top/azure/cost-management-billing/automate/understand-usage-details-fields
* x-ms-original-file: 2025-03-01/GenerateCostDetailsReportBySubscriptionAndTimePeriod.json
*/
async function generateCostDetailsReportBySubscriptionAndTimePeriod() {
const credential = new DefaultAzureCredential();
const client = new CostManagementClient(credential);
const result = await client.generateCostDetailsReport.createOperation(
"subscriptions/00000000-0000-0000-0000-000000000000",
{ metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } },
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Respuesta de muestra
{
"name": "00000000-0000-0000-0000-000000000000",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000",
"manifest": {
"blobCount": 1,
"blobs": [
{
"blobLink": "https://ccmreportstorageeastus.blob.core.windows.net/armreports/00000/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd",
"byteCount": 32741
}
],
"byteCount": 32741,
"compressData": false,
"dataFormat": "Csv",
"manifestVersion": "2025-03-01",
"requestContext": {
"requestBody": {
"metric": "ActualCost",
"timePeriod": {
"end": "2020-03-15",
"start": "2020-03-01"
}
},
"requestScope": "subscriptions/00000000-0000-0000-0000-000000000000"
}
},
"status": "Completed",
"validTill": "2022-05-10T08:08:46.1973252Z"
}
Location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/costDetailsOperationResults/00000000-0000-0000-0000-000000000000?api-version=2025-03-01
Retry-After: 60
Definiciones
| Nombre |
Description |
|
BlobInfo
|
La información del blob generada por esta operación.
|
|
CostDetailsDataFormat
|
Formato de datos del informe
|
|
CostDetailsMetricType
|
Tipo del informe detallado. De forma predeterminada, se proporciona ActualCost
|
|
CostDetailsOperationResults
|
Resultado de la operación de larga duración para obtener detalles de costo API.
|
|
CostDetailsStatusType
|
Estado de la operación de detalles de costos
|
|
CostDetailsTimePeriod
|
Fecha de inicio y finalización para extraer datos del informe detallado del costo. La API solo permite extraer datos durante 1 mes o menos y no más de 13 meses.
|
|
ErrorDetails
|
Detalles del error.
|
|
GenerateCostDetailsReportErrorResponse
|
La respuesta de error indica que el servicio no puede procesar la solicitud entrante. El motivo se proporciona en el mensaje de error.
Algunas respuestas de error:
400 Solicitud incorrecta: carga de solicitud no válida. La carga de solicitud proporcionada no está en un formato JSON o tenía un miembro no válido no aceptado en la carga de la solicitud.
400 Solicitud incorrecta: carga de solicitud no válida: solo puede tener timePeriod o invoiceId o billingPeriod. La API solo permite extraer datos para timePeriod o invoiceId o billingPeriod. El cliente debe proporcionar solo uno de estos parámetros.
400 Solicitud incorrecta: la fecha de inicio debe ser posterior a . La API solo permite extraer datos que no tienen más de 13 meses de ahora.
400 Solicitud incorrecta: el intervalo de fechas máximo permitido es de 1 meses. La API solo permite extraer datos durante 1 mes o menos.
429 TooManyRequests: la solicitud está limitada. Vuelva a intentarlo después de esperar el tiempo especificado en el encabezado "retry-after".
503 ServiceUnavailable: el servicio no está disponible temporalmente. Vuelva a intentarlo después de esperar el tiempo especificado en el encabezado "Retry-After".
|
|
GenerateCostDetailsReportRequestDefinition
|
Definición de un informe detallado de costos.
|
BlobInfo
Objeto
La información del blob generada por esta operación.
| Nombre |
Tipo |
Description |
|
blobLink
|
string
|
Vínculo al blob para descargar el archivo.
|
|
byteCount
|
integer
(int64)
|
Bytes en el blob.
|
Enumeración
Formato de datos del informe
| Valor |
Description |
|
Csv
|
Formato de datos CSV.
|
CostDetailsMetricType
Enumeración
Tipo del informe detallado. De forma predeterminada, se proporciona ActualCost
| Valor |
Description |
|
ActualCost
|
Datos de costos reales.
|
|
AmortizedCost
|
Datos de costos amortizados.
|
CostDetailsOperationResults
Objeto
Resultado de la operación de larga duración para obtener detalles de costo API.
| Nombre |
Tipo |
Description |
|
error
|
ErrorDetails
|
Detalles del error.
|
|
id
|
string
|
Identificador de la operación de larga duración.
|
|
manifest.blobCount
|
integer
(int32)
|
Número total de blobs.
|
|
manifest.blobs
|
BlobInfo[]
|
Lista de información de blobs generada por esta operación.
|
|
manifest.byteCount
|
integer
(int64)
|
Número total de bytes en todos los blobs.
|
|
manifest.compressData
|
boolean
|
Es los datos en formato comprimido.
|
|
manifest.dataFormat
|
CostDetailsDataFormat
|
Formato de datos del informe
|
|
manifest.manifestVersion
|
string
|
Versión del manifiesto.
|
|
manifest.requestContext.requestBody
|
GenerateCostDetailsReportRequestDefinition
|
El cuerpo de la carga de solicitud proporcionado en la llamada a Cost Details
|
|
manifest.requestContext.requestScope
|
string
|
Ámbito de solicitud de la solicitud.
|
|
name
|
string
|
Nombre de la operación de larga duración.
|
|
status
|
CostDetailsStatusType
|
Estado de la operación de detalles de costos
|
|
type
|
string
|
Tipo de la operación de larga duración.
|
|
validTill
|
string
(date-time)
|
La hora a la que la dirección URL del informe deja de ser válida o expira en UTC, por ejemplo, 2020-12-08T05:55:59.4394737Z.
|
CostDetailsStatusType
Enumeración
Estado de la operación de detalles de costos
| Valor |
Description |
|
Completed
|
La operación se ha completado.
|
|
NoDataFound
|
La operación se ha completado y no se encontraron datos de costo.
|
|
Failed
|
Error en la operación.
|
CostDetailsTimePeriod
Objeto
Fecha de inicio y finalización para extraer datos del informe detallado del costo. La API solo permite extraer datos durante 1 mes o menos y no más de 13 meses.
| Nombre |
Tipo |
Description |
|
end
|
string
|
Fecha de finalización a la que se van a extraer los datos. formato de ejemplo 2020-03-15
|
|
start
|
string
|
Fecha de inicio de la que se van a extraer datos. formato de ejemplo 2020-03-15
|
ErrorDetails
Objeto
Detalles del error.
| Nombre |
Tipo |
Description |
|
code
|
string
|
Código de error.
|
|
message
|
string
|
Mensaje de error que indica por qué se produjo un error en la operación.
|
GenerateCostDetailsReportErrorResponse
Objeto
La respuesta de error indica que el servicio no puede procesar la solicitud entrante. El motivo se proporciona en el mensaje de error.
Algunas respuestas de error:
400 Solicitud incorrecta: carga de solicitud no válida. La carga de solicitud proporcionada no está en un formato JSON o tenía un miembro no válido no aceptado en la carga de la solicitud.
400 Solicitud incorrecta: carga de solicitud no válida: solo puede tener timePeriod o invoiceId o billingPeriod. La API solo permite extraer datos para timePeriod o invoiceId o billingPeriod. El cliente debe proporcionar solo uno de estos parámetros.
400 Solicitud incorrecta: la fecha de inicio debe ser posterior a . La API solo permite extraer datos que no tienen más de 13 meses de ahora.
400 Solicitud incorrecta: el intervalo de fechas máximo permitido es de 1 meses. La API solo permite extraer datos durante 1 mes o menos.
429 TooManyRequests: la solicitud está limitada. Vuelva a intentarlo después de esperar el tiempo especificado en el encabezado "retry-after".
503 ServiceUnavailable: el servicio no está disponible temporalmente. Vuelva a intentarlo después de esperar el tiempo especificado en el encabezado "Retry-After".
| Nombre |
Tipo |
Description |
|
error
|
ErrorDetails
|
Detalles del error.
|
GenerateCostDetailsReportRequestDefinition
Objeto
Definición de un informe detallado de costos.
| Nombre |
Tipo |
Description |
|
billingPeriod
|
string
|
Los clientes del Contrato Enterprise solo pueden usar este parámetro. Use el formato YearMonth(por ejemplo, 202008). Este parámetro no se puede usar junto con los parámetros invoiceId o timePeriod. Si no se proporciona un parámetro timePeriod, invoiceId o billingPeriod en el cuerpo de la solicitud, la API devolverá el costo del mes actual.
|
|
invoiceId
|
string
|
Los clientes del Contrato de cliente de Microsoft solo pueden usar este parámetro. Además, solo se puede usar en el ámbito perfil de facturación o cliente. Este parámetro no se puede usar junto con los parámetros billingPeriod o timePeriod. Si no se proporciona un parámetro timePeriod, invoiceId o billingPeriod en el cuerpo de la solicitud, la API devolverá el costo del mes actual.
|
|
metric
|
CostDetailsMetricType
|
Tipo del informe detallado. De forma predeterminada, se proporciona ActualCost
|
|
timePeriod
|
CostDetailsTimePeriod
|
Intervalo de fechas específico de los detalles de costo solicitados para el informe. Este parámetro no se puede usar junto con los parámetros invoiceId o billingPeriod. Si no se proporciona un parámetro timePeriod, invoiceId o billingPeriod en el cuerpo de la solicitud, la API devolverá el costo del mes actual. La API solo permite extraer datos durante 1 mes o menos y no más de 13 meses. Si no se proporciona timePeriod o billingPeriod o invoiceId, la API tiene como valor predeterminado el período de tiempo del mes abierto.
|