Skip to content

Collector Configuration Manual for "Azure - Cloud Billing (Instance Dimension)"

Before reading this article, please first read:

Before using this collector, you must install the 'Integration Core Package' and its associated third-party dependency packages.

To ensure data integrity, the billing date collected is the day before the current date. For example: 2022-07-03 00:00:00 ~ 23:59:59 will collect data from 2022-07-02.

1. Configuration Structure

This collector requires no configuration.

2. Data Reporting Format

After data synchronization, you can view it in the "Cloud Billing Explorer" of TrueWatch.

An example of the reported data is as follows:

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[
  {
    "category": "cloud_billing",
    "fields": {
      "amount": 0.000362931030000001,
      "message": "[0.000362931030000001, 0.000362931030000001, 20241126, \"func-resource\", \"/subscriptions/63a4a998-bd43-4cca-bd86-c4e7ed33a643/resourcegroups/func-resource/providers/microsoft.storage/storageaccounts/dffunc\", \"Storage\", \"us east\", \"ZP57-7TMW-BG7-PGB\", \"HM LU\", \"63a4a998-bd43-4cca-bd86-c4e7ed33a643\", \"Azure \\u8ba2\\u9605 1\", \"CNY\"]",
      "pre_tax_amount": 0.000362931030000001
    },
    "measurement": "cloud_billing",
    "tags": {
      "account_id": "ZP57-7TMW-BG7-PGB",
      "account_name": "HM LU",
      "billing_date": "2024-11-26",
      "billing_id": "2dcc4b206fe5b90a86540261b9aab7c103e7bff4204e2c54c022132cc7569b80",
      "billing_timestamp": "1732636799",
      "instance_id": "/subscriptions/63a4a998-bd43-4cca-bd86-c4e7ed33a643/resourcegroups/func-resource/providers/microsoft.storage/storageaccounts/dffunc",
      "name": "/subscriptions/63a4a998-bd43-4cca-bd86-c4e7ed33a643/resourcegroups/func-resource/providers/microsoft.storage/storageaccounts/dffunc",
      "product_code": "Storage",
      "product_name": "Storage",
      "region_id": "us east",
      "region_name": "us east",
      "resource_id": "/subscriptions/63a4a998-bd43-4cca-bd86-c4e7ed33a643/resourcegroups/func-resource/providers/microsoft.storage/storageaccounts/dffunc",
      "subscription_id": "63a4a998-bd43-4cca-bd86-c4e7ed33a643",
      "subscription_name": "Azure Subscription 1"
    },
    "timestamp": 1732636799
  }
]

The fields in tags and fields may change with subsequent updates.

3. Field Description

Reported Field API Return Field API Field Meaning Notes
Billing ID billing_id Unique billing ID
Product Code product_code ServiceName Cloud service type code
Product Name product_name ServiceName Cloud service type name
Paid Amount amount Cost User-paid amount including tax
Paid Amount (Excluding Tax) pre_tax_amount PreTaxCost User-paid amount excluding tax
Billing Period billing_date UsageDate Resource consumption record date. Format: YYYYMMDD
Region ID region_id ResourceLocation Region ID
Region region_name ResourceLocation Region name
Instance ID instance_id ResourceId Instance ID / Resource ID
Consumer ID account_id BillingProfileId Billing profile ID used to generate independent invoices.
Consumer Name account_name BillingProfileName Billing profile name for user identification.
Subscription ID subscription_id SubscriptionId Unique identifier for subscription, used to segment subscription-level costs.
Subscription Name subscription_name SubscriptionName Friendly name for subscription, helps users identify specific subscriptions.

Each time the script runs, the data granularity is Resource (Instance) ID: ResourceId; the billing consumption amounts for identical instances are combined. Refer below for a comparison between Azure API Raw Data and Script Aggregated Data.

Azure API Interface Raw Data

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
  "id": "subscriptions/63a4a998-bd43-4cca-bd86-c4e7ed33a643/providers/Microsoft.CostManagement/query/3d4323d5-4408-4b3a-b81b-7f0b76679a7e",
  "name": "3d4323d5-4408-4b3a-b81b-7f0b76679a7e",
  "type": "Microsoft.CostManagement/query",
  "location": null,
  "sku": null,
  "eTag": null,
  "properties": {
    "nextLink": null,
    "columns": [
      {
        "name": "PreTaxCost",
        "type": "Number"
      },
      {
        "name": "Cost",
        "type": "Number"
      },
      {
        "name": "UsageDate",
        "type": "Number"
      },
      {
        "name": "ResourceId",
        "type": "String"
      },
      {
        "name": "ServiceName",
        "type": "String"
      },
      {
        "name": "ResourceLocation",
        "type": "String"
      },
      {
        "name": "BillingProfileId",
        "type": "String"
      },
      {
        "name": "BillingProfileName",
        "type": "String"
      },
      {
        "name": "SubscriptionId",
        "type": "String"
      },
      {
        "name": "SubscriptionName",
        "type": "String"
      },
      {
        "name": "Currency",
        "type": "String"
      }
    ],
    "rows": [
      [
        0,
        0,
        20241001,
        "/subscriptions/63a4a998-bd43-4cca-bd86-c4e7ed33a643/providers/microsoft.insights/pricings/metricsquery",
        "Azure Monitor",
        "us east",
        "ZP57-7TMW-BG7-PGB",
        "HM LU",
        "63a4a998-bd43-4cca-bd86-c4e7ed33a643",
        "Azure Subscription 1",
        "CNY"
      ]
    ]
  }
}

Script Aggregated Data

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[
  {
    "category": "cloud_billing",
    "fields": {
      "amount": 0.000362931030000001,
      "message": "[0.000362931030000001, 0.000362931030000001, 20241126, \"func-resource\", \"/subscriptions/63a4a998-bd43-4cca-bd86-c4e7ed33a643/resourcegroups/func-resource/providers/microsoft.storage/storageaccounts/dffunc\", \"Storage\", \"us east\", \"ZP57-7TMW-BG7-PGB\", \"HM LU\", \"63a4a998-bd43-4cca-bd86-c4e7ed33a643\", \"Azure \\u8ba2\\u9605 1\", \"CNY\"]",
      "pre_tax_amount": 0.000362931030000001
    },
    "measurement": "cloud_billing",
    "tags": {
      "account_id": "ZP57-7TMW-BG7-PGB",
      "account_name": "HM LU",
      "billing_date": "2024-11-26",
      "billing_id": "2dcc4b206fe5b90a86540261b9aab7c103e7bff4204e2c54c022132cc7569b80",
      "billing_timestamp": "1732636799",
      "instance_id": "/subscriptions/63a4a998-bd43-4cca-bd86-c4e7ed33a643/resourcegroups/func-resource/providers/microsoft.storage/storageaccounts/dffunc",
      "name": "/subscriptions/63a4a998-bd43-4cca-bd86-c4e7ed33a643/resourcegroups/func-resource/providers/microsoft.storage/storageaccounts/dffunc",
      "product_code": "Storage",
      "product_name": "Storage",
      "region_id": "us east",
      "region_name": "us east",
      "resource_id": "/subscriptions/63a4a998-bd43-4cca-bd86-c4e7ed33a643/resourcegroups/func-resource/providers/microsoft.storage/storageaccounts/dffunc",
      "subscription_id": "63a4a998-bd43-4cca-bd86-c4e7ed33a643",
      "subscription_name": "Azure Subscription 1"
    },
    "timestamp": 1732636799
  }
]

X. Appendix

Azure - Billing Management "Query Resource Usage Records"

Refer to the official Azure documentation: