Query - Usage
定義されたスコープの使用状況データに対してクエリを実行します。
POST https://management.azure.com/{scope}/providers/Microsoft.CostManagement/query?api-version=2025-03-01
URI パラメーター
| 名前 | / | 必須 | 型 | 説明 |
|---|---|---|---|---|
|
scope
|
path | True |
string |
クエリ操作とエクスポート操作に関連付けられているスコープ。 これには、サブスクリプション スコープの '/subscriptions/{subscriptionId}/'、resourceGroup スコープの '/subscriptionId}/{subscriptionId}/resourceGroups/{resourceGroupName}' が含まれます。 '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/{billingAccountId}/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccount スコープの enrollmentAccountId}'、管理グループ スコープの '/providers/Microsoft.Management/managementGroups/{managementGroupId} '/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 minLength: 1 |
この操作に使用する API バージョン。 |
要求本文
| 名前 | 必須 | 型 | 説明 |
|---|---|---|---|
| dataset | True |
このクエリのデータの定義があります。 |
|
| timeframe | True |
クエリのデータをプルする期間。 カスタムの場合は、特定の期間を指定する必要があります。 |
|
| type | True |
クエリの種類。 |
|
| timePeriod |
クエリのデータをプルするための期間があります。 |
応答
| 名前 | 型 | 説明 |
|---|---|---|
| 200 OK |
Azure 操作は正常に完了しました。 |
|
| 204 No Content |
この要求に送信するコンテンツはありませんが、ヘッダーが役立つ場合があります。 |
|
| Other Status Codes |
予期しないエラー応答。 |
セキュリティ
azure_auth
Azure Active Directory OAuth2 フロー。
型:
oauth2
フロー:
implicit
Authorization URL (承認 URL):
https://login.microsoftonline.com/common/oauth2/authorize
スコープ
| 名前 | 説明 |
|---|---|
| user_impersonation | ユーザー アカウントを偽装する |
例
BillingAccountQuery-Legacy
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"filter": {
"and": [
{
"or": [
{
"dimensions": {
"name": "ResourceLocation",
"operator": "In",
"values": [
"East US",
"West Europe"
]
}
},
{
"tags": {
"name": "Environment",
"operator": "In",
"values": [
"UAT",
"Prod"
]
}
}
]
},
{
"dimensions": {
"name": "ResourceGroup",
"operator": "In",
"values": [
"API"
]
}
}
]
},
"granularity": "Daily"
},
"timeframe": "MonthToDate"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
20180331,
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
20180331,
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
20180331,
"USD"
],
[
0.16677720329728665,
"gs-stms-dev",
20180331,
"USD"
]
]
}
}
BillingAccountQuery-MCA
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"filter": {
"and": [
{
"or": [
{
"dimensions": {
"name": "ResourceLocation",
"operator": "In",
"values": [
"East US",
"West Europe"
]
}
},
{
"tags": {
"name": "Environment",
"operator": "In",
"values": [
"UAT",
"Prod"
]
}
}
]
},
{
"dimensions": {
"name": "ResourceGroup",
"operator": "In",
"values": [
"API"
]
}
}
]
},
"granularity": "Daily"
},
"timeframe": "MonthToDate"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
20180331,
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
20180331,
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
20180331,
"USD"
],
[
0.16677720329728665,
"gs-stms-dev",
20180331,
"USD"
]
]
}
}
BillingAccountQueryGrouping-Legacy
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"granularity": "None",
"grouping": [
{
"name": "ResourceGroup",
"type": "Dimension"
}
]
},
"timeframe": "TheLastMonth"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
"USD"
]
]
}
}
BillingAccountQueryGrouping-MCA
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"granularity": "None",
"grouping": [
{
"name": "ResourceGroup",
"type": "Dimension"
}
]
},
"timeframe": "TheLastMonth"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
"USD"
]
]
}
}
BillingProfileQuery-MCA
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"filter": {
"and": [
{
"or": [
{
"dimensions": {
"name": "ResourceLocation",
"operator": "In",
"values": [
"East US",
"West Europe"
]
}
},
{
"tags": {
"name": "Environment",
"operator": "In",
"values": [
"UAT",
"Prod"
]
}
}
]
},
{
"dimensions": {
"name": "ResourceGroup",
"operator": "In",
"values": [
"API"
]
}
}
]
},
"granularity": "Daily"
},
"timeframe": "MonthToDate"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
20180331,
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
20180331,
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
20180331,
"USD"
],
[
0.16677720329728665,
"gs-stms-dev",
20180331,
"USD"
]
]
}
}
BillingProfileQueryGrouping-MCA
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"granularity": "None",
"grouping": [
{
"name": "ResourceGroup",
"type": "Dimension"
}
]
},
"timeframe": "TheLastMonth"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
"USD"
]
]
}
}
CustomerQuery-MCA
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"filter": {
"and": [
{
"or": [
{
"dimensions": {
"name": "ResourceLocation",
"operator": "In",
"values": [
"East US",
"West Europe"
]
}
},
{
"tags": {
"name": "Environment",
"operator": "In",
"values": [
"UAT",
"Prod"
]
}
}
]
},
{
"dimensions": {
"name": "ResourceGroup",
"operator": "In",
"values": [
"API"
]
}
}
]
},
"granularity": "Daily"
},
"timeframe": "MonthToDate"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
20180331,
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
20180331,
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
20180331,
"USD"
],
[
0.16677720329728665,
"gs-stms-dev",
20180331,
"USD"
]
]
}
}
CustomerQueryGrouping-MCA
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"granularity": "None",
"grouping": [
{
"name": "ResourceGroup",
"type": "Dimension"
}
]
},
"timeframe": "TheLastMonth"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
"USD"
]
]
}
}
DepartmentQuery-Legacy
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/100/departments/123/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"filter": {
"and": [
{
"or": [
{
"dimensions": {
"name": "ResourceLocation",
"operator": "In",
"values": [
"East US",
"West Europe"
]
}
},
{
"tags": {
"name": "Environment",
"operator": "In",
"values": [
"UAT",
"Prod"
]
}
}
]
},
{
"dimensions": {
"name": "ResourceGroup",
"operator": "In",
"values": [
"API"
]
}
}
]
},
"granularity": "Daily"
},
"timeframe": "MonthToDate"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/70664866/departments/123/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/70664866/departments/123/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
20180331,
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
20180331,
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
20180331,
"USD"
],
[
0.16677720329728665,
"gs-stms-dev",
20180331,
"USD"
]
]
}
}
DepartmentQueryGrouping-Legacy
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/100/departments/123/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"granularity": "None",
"grouping": [
{
"name": "ResourceGroup",
"type": "Dimension"
}
]
},
"timeframe": "TheLastMonth"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/70664866/departments/123/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/70664866/departments/123/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
"USD"
]
]
}
}
EnrollmentAccountQuery-Legacy
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"filter": {
"and": [
{
"or": [
{
"dimensions": {
"name": "ResourceLocation",
"operator": "In",
"values": [
"East US",
"West Europe"
]
}
},
{
"tags": {
"name": "Environment",
"operator": "In",
"values": [
"UAT",
"Prod"
]
}
}
]
},
{
"dimensions": {
"name": "ResourceGroup",
"operator": "In",
"values": [
"API"
]
}
}
]
},
"granularity": "Daily"
},
"timeframe": "MonthToDate"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/70664866/enrollmentAccounts/456/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/70664866/enrollmentAccounts/456/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
20180331,
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
20180331,
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
20180331,
"USD"
],
[
0.16677720329728665,
"gs-stms-dev",
20180331,
"USD"
]
]
}
}
EnrollmentAccountQueryGrouping-Legacy
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"granularity": "Daily",
"grouping": [
{
"name": "ResourceGroup",
"type": "Dimension"
}
]
},
"timeframe": "TheLastMonth"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/70664866/enrollmentAccounts/456/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/70664866/enrollmentAccounts/456/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
20180331,
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
20180331,
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
20180331,
"USD"
]
]
}
}
InvoiceSectionQuery-MCA
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"filter": {
"and": [
{
"or": [
{
"dimensions": {
"name": "ResourceLocation",
"operator": "In",
"values": [
"East US",
"West Europe"
]
}
},
{
"tags": {
"name": "Environment",
"operator": "In",
"values": [
"UAT",
"Prod"
]
}
}
]
},
{
"dimensions": {
"name": "ResourceGroup",
"operator": "In",
"values": [
"API"
]
}
}
]
},
"granularity": "Daily"
},
"timeframe": "MonthToDate"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
20180331,
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
20180331,
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
20180331,
"USD"
],
[
0.16677720329728665,
"gs-stms-dev",
20180331,
"USD"
]
]
}
}
InvoiceSectionQueryGrouping-MCA
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"granularity": "None",
"grouping": [
{
"name": "ResourceGroup",
"type": "Dimension"
}
]
},
"timeframe": "TheLastMonth"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
"USD"
]
]
}
}
ManagementGroupQuery-Legacy
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"filter": {
"and": [
{
"or": [
{
"dimensions": {
"name": "ResourceLocation",
"operator": "In",
"values": [
"East US",
"West Europe"
]
}
},
{
"tags": {
"name": "Environment",
"operator": "In",
"values": [
"UAT",
"Prod"
]
}
}
]
},
{
"dimensions": {
"name": "ResourceGroup",
"operator": "In",
"values": [
"API"
]
}
}
]
},
"granularity": "Daily"
},
"timeframe": "MonthToDate"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
19.545363672276512,
"JapanUnifia-Trial",
20180331,
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
20180331,
"USD"
],
[
20.35941656262545,
"VSTSHOL-1595322048000",
20180331,
"USD"
],
[
0.16677720329728665,
"gs-stms-dev",
20180331,
"USD"
]
]
}
}
ManagementGroupQueryGrouping-Legacy
要求のサンプル
POST https://management.azure.com/providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"granularity": "None",
"grouping": [
{
"name": "ResourceGroup",
"type": "Dimension"
}
]
},
"timeframe": "TheLastMonth"
}
応答のサンプル
{
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"id": "/providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": "https://management.azure.com/providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D",
"rows": [
[
20.35941656262545,
"VSTSHOL-1595322048000",
20180331,
"USD"
],
[
173.41979241290323,
"RVIIOT-TRIAL",
20180331,
"USD"
],
[
19.545363672276512,
"JapanUnifia-Trial",
20180331,
"USD"
]
]
}
}
ResourceGroupQuery-Legacy
要求のサンプル
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"filter": {
"and": [
{
"or": [
{
"dimensions": {
"name": "ResourceLocation",
"operator": "In",
"values": [
"East US",
"West Europe"
]
}
},
{
"tags": {
"name": "Environment",
"operator": "In",
"values": [
"UAT",
"Prod"
]
}
}
]
},
{
"dimensions": {
"name": "ResourceGroup",
"operator": "In",
"values": [
"API"
]
}
}
]
},
"granularity": "Daily"
},
"timeframe": "MonthToDate"
}
応答のサンプル
{
"name": "9af9459d-441d-4055-9ed0-83d4c4a363fb",
"type": "microsoft.costmanagement/Query",
"id": "/subscriptions/55312978-ba1b-415c-9304-c4b9c43c0481/resourcegroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/Query/9af9459d-441d-4055-9ed0-83d4c4a363fb",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": null,
"rows": [
[
2.10333307059661,
"ScreenSharingTest-peer",
20180417,
"USD"
],
[
20.10333307059661,
"ScreenSharingTest-peer",
20180418,
"USD"
]
]
}
}
ResourceGroupQueryGrouping-Legacy
要求のサンプル
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"granularity": "Daily",
"grouping": [
{
"name": "ResourceType",
"type": "Dimension"
}
]
},
"timeframe": "TheLastMonth"
}
応答のサンプル
{
"name": "9af9459d-441d-4055-9ed0-83d4c4a363fb",
"type": "microsoft.costmanagement/Query",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/Query/9af9459d-441d-4055-9ed0-83d4c4a363fb",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceType",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": null,
"rows": [
[
2.10333307059661,
"Microsoft.SqlServer",
20180417,
"USD"
],
[
20.10333307059661,
"Microsoft.Compute",
20180418,
"USD"
]
]
}
}
SubscriptionQuery-Legacy
要求のサンプル
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"filter": {
"and": [
{
"or": [
{
"dimensions": {
"name": "ResourceLocation",
"operator": "In",
"values": [
"East US",
"West Europe"
]
}
},
{
"tags": {
"name": "Environment",
"operator": "In",
"values": [
"UAT",
"Prod"
]
}
}
]
},
{
"dimensions": {
"name": "ResourceGroup",
"operator": "In",
"values": [
"API"
]
}
}
]
},
"granularity": "Daily"
},
"timeframe": "MonthToDate"
}
応答のサンプル
{
"name": "55312978-ba1b-415c-9304-cfd9c43c0481",
"type": "microsoft.costmanagement/Query",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/Query/00000000-0000-0000-0000-000000000000",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": null,
"rows": [
[
2.10333307059661,
"ScreenSharingTest-peer",
20180331,
"USD"
],
[
218.68795741935486,
"Ict_StratAndPlan_GoldSprova_Prod",
20180331,
"USD"
],
[
0.14384913581657052,
"ssbciotelement01",
20180401,
"USD"
],
[
0.009865586851323632,
"ict_stratandplan_goldsprova_prod",
20180429,
"USD"
]
]
}
}
SubscriptionQueryGrouping-Legacy
要求のサンプル
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/query?api-version=2025-03-01
{
"type": "Usage",
"dataset": {
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"granularity": "None",
"grouping": [
{
"name": "ResourceGroup",
"type": "Dimension"
}
]
},
"timeframe": "TheLastMonth"
}
応答のサンプル
{
"name": "55312978-ba1b-415c-9304-cfd9c43c0481",
"type": "microsoft.costmanagement/Query",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/Query/00000000-0000-0000-0000-000000000000",
"properties": {
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "Currency",
"type": "String"
}
],
"nextLink": null,
"rows": [
[
0.009865586851323632,
"Ict_StratAndPlan_GoldSprova_Prod_0",
"USD"
],
[
218.68795741935486,
"Ict_StratAndPlan_GoldSprova_Prod_1",
"USD"
],
[
2.10333307059661,
"ScreenSharingTest-peer1",
"USD"
],
[
0.14384913581657052,
"Ssbciotelement01",
"USD"
]
]
}
}
定義
| 名前 | 説明 |
|---|---|
|
Error |
エラーの詳細。 |
|
Error |
エラー応答は、サービスが受信要求を処理できないことを示します。 エラー メッセージに理由が示されます。 \n\nいくつかのエラー応答:\n\n * 429 TooManyRequests - リクエストがスロットルされています。 "x-ms-ratelimit-microsoft.consumption-retry-after" ヘッダーで指定された時刻を待機した後に再試行します。 \n\n * 503 サービス不可 - サービスが一時的に利用できません。 "Retry-After" ヘッダーで指定された時刻を待機した後に再試行します。 |
|
Export |
エクスポートの種類。 'Usage' は 'ActualCost' に相当し、サービス予約の料金や償却のためのデータをまだ提供していないエクスポートに適用されることに注意してください。 |
|
Function |
使用する集計関数の名前。 |
|
Granularity |
エクスポート内の行の粒度。 現在、ほとんどの場合は 'Daily' がサポートされています。 |
|
Query |
クエリで使用する集計式。 |
|
Query |
QueryColumn プロパティ |
|
Query |
報告書内の列の種類。 |
|
Query |
クエリで使用する比較式。 |
|
Query |
クエリに存在するデータの定義。 |
|
Query |
クエリ内のデータセットの構成。 |
|
Query |
クエリの定義。 |
|
Query |
エクスポートで使用するフィルター式。 |
|
Query |
クエリで使用するグループ化式。 |
|
Query |
比較に使用する演算子。 |
|
Query |
クエリの結果。 グループ化と集計の下に一覧表示されているすべての列が含まれます。 |
|
Query |
クエリのデータをプルするための開始日と終了日。 |
|
Timeframe |
エクスポートのデータをプルする期間。 カスタムの場合は、特定の期間を指定する必要があります。 |
ErrorDetails
エラーの詳細。
| 名前 | 型 | 説明 |
|---|---|---|
| code |
string |
エラー コード。 |
| message |
string |
操作が失敗した理由を示すエラー メッセージ。 |
ErrorResponse
エラー応答は、サービスが受信要求を処理できないことを示します。 エラー メッセージに理由が示されます。 \n\nいくつかのエラー応答:\n\n * 429 TooManyRequests - リクエストがスロットルされています。 "x-ms-ratelimit-microsoft.consumption-retry-after" ヘッダーで指定された時刻を待機した後に再試行します。 \n\n * 503 サービス不可 - サービスが一時的に利用できません。 "Retry-After" ヘッダーで指定された時刻を待機した後に再試行します。
| 名前 | 型 | 説明 |
|---|---|---|
| error |
エラーの詳細。 |
ExportType
エクスポートの種類。 'Usage' は 'ActualCost' に相当し、サービス予約の料金や償却のためのデータをまだ提供していないエクスポートに適用されることに注意してください。
| 値 | 説明 |
|---|---|
| Usage | |
| ActualCost | |
| AmortizedCost | |
| FocusCost | |
| PriceSheet | |
| ReservationTransactions | |
| ReservationRecommendations | |
| ReservationDetails |
FunctionType
使用する集計関数の名前。
| 値 | 説明 |
|---|---|
| Sum |
GranularityType
エクスポート内の行の粒度。 現在、ほとんどの場合は 'Daily' がサポートされています。
| 値 | 説明 |
|---|---|
| Daily | |
| Monthly |
QueryAggregation
クエリで使用する集計式。
| 名前 | 型 | 説明 |
|---|---|---|
| function |
使用する集計関数の名前。 |
|
| name |
string |
集計する列の名前。 |
QueryColumn
QueryColumn プロパティ
| 名前 | 型 | 説明 |
|---|---|---|
| name |
string |
列の名前。 |
| type |
string |
列の型。 |
QueryColumnType
報告書内の列の種類。
| 値 | 説明 |
|---|---|
| TagKey |
コスト データに関連付けられているタグ。 |
| Dimension |
コスト データのディメンション。 |
QueryComparisonExpression
クエリで使用する比較式。
| 名前 | 型 | 説明 |
|---|---|---|
| name |
string |
比較に使用する列の名前。 |
| operator |
比較に使用する演算子。 |
|
| values |
string[] |
比較に使用する値の配列 |
QueryDataset
クエリに存在するデータの定義。
| 名前 | 型 | 説明 |
|---|---|---|
| aggregation |
<string,
Query |
クエリで使用する集計式のディクショナリ。 ディクショナリ内の各項目のキーは、集計列のエイリアスです。 クエリには、最大 2 つの集計句を含めることができます。 |
| configuration |
エクスポート内のデータの構成情報があります。 集計とグループ化が指定されている場合、構成は無視されます。 |
|
| filter |
クエリで使用するフィルター式。 フィルターを適切にフォーマットする方法については、Query API REST のドキュメントを参照してください。 |
|
| granularity |
クエリ内の行の粒度。 |
|
| grouping |
クエリで使用する式によるグループの配列。 クエリには、最大 2 つの group by 句を含めることができます。 |
QueryDatasetConfiguration
クエリ内のデータセットの構成。
| 名前 | 型 | 説明 |
|---|---|---|
| columns |
string[] |
クエリに含める列名の配列。 任意の有効なクエリ列名を使用できます。 指定しない場合は、クエリにすべての列が含まれます。 |
QueryDefinition
クエリの定義。
| 名前 | 型 | 説明 |
|---|---|---|
| dataset |
このクエリのデータの定義があります。 |
|
| timePeriod |
クエリのデータをプルするための期間があります。 |
|
| timeframe |
クエリのデータをプルする期間。 カスタムの場合は、特定の期間を指定する必要があります。 |
|
| type |
クエリの種類。 |
QueryFilter
エクスポートで使用するフィルター式。
| 名前 | 型 | 説明 |
|---|---|---|
| and |
論理 "AND" 式。 少なくとも 2 つの項目が必要です。 |
|
| dimensions |
ディメンションの比較式を持つ |
|
| or |
論理 "OR" 式。 少なくとも 2 つの項目が必要です。 |
|
| tags |
タグの比較式を持つ |
QueryGrouping
クエリで使用するグループ化式。
| 名前 | 型 | 説明 |
|---|---|---|
| name |
string |
グループ化する列の名前。 |
| type |
グループ化する列の型を持つ。 |
QueryOperatorType
比較に使用する演算子。
| 値 | 説明 |
|---|---|
| In |
QueryResult
クエリの結果。 グループ化と集計の下に一覧表示されているすべての列が含まれます。
| 名前 | 型 | 説明 |
|---|---|---|
| eTag |
string |
リソースの ETag。 |
| id |
string |
リソース ID。 |
| location |
string |
リソースの場所。 |
| name |
string |
リソース名。 |
| properties.columns |
列の配列 |
|
| properties.nextLink |
string |
結果の次のページへのリンク (URL)。 |
| properties.rows |
Rows[] |
行の配列 |
| sku |
string |
リソースの SKU。 |
| tags |
object |
リソース タグ。 |
| type |
string |
リソースの種類。 |
QueryTimePeriod
クエリのデータをプルするための開始日と終了日。
| 名前 | 型 | 説明 |
|---|---|---|
| from |
string (date-time) |
データをプルする開始日。 |
| to |
string (date-time) |
データをプルする終了日。 |
TimeframeType
エクスポートのデータをプルする期間。 カスタムの場合は、特定の期間を指定する必要があります。
| 値 | 説明 |
|---|---|
| MonthToDate | |
| BillingMonthToDate | |
| TheLastMonth | |
| TheLastBillingMonth | |
| WeekToDate | |
| Custom | |
| TheCurrentMonth |