Query the usage data for scope defined.
POST https://management.azure.com/{scope}/providers/Microsoft.CostManagement/query?api-version=2025-03-01
URI Parameters
| Name |
In |
Required |
Type |
Description |
|
scope
|
path |
True
|
string
|
The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
The API version to use for this operation.
|
Request Body
| Name |
Required |
Type |
Description |
|
dataset
|
True
|
QueryDataset
|
Has definition for data in this query.
|
|
timeframe
|
True
|
TimeframeType
|
The time frame for pulling data for the query. If custom, then a specific time period must be provided.
|
|
type
|
True
|
ExportType
|
The type of the query.
|
|
timePeriod
|
|
QueryTimePeriod
|
Has time period for pulling data for the query.
|
Responses
| Name |
Type |
Description |
|
200 OK
|
QueryResult
|
Azure operation completed successfully.
|
|
204 No Content
|
|
There is no content to send for this request, but the headers may be useful.
|
|
Other Status Codes
|
ErrorResponse
|
An unexpected error response.
|
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
| Name |
Description |
|
user_impersonation
|
impersonate your user account
|
Examples
BillingAccountQuery-Legacy
Sample request
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"
}
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/BillingAccountQuery.json
func ExampleQueryClient_Usage_billingAccountQueryLegacy() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/70664866", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Filter: &armcostmanagement.QueryFilter{
And: []*armcostmanagement.QueryFilter{
{
Or: []*armcostmanagement.QueryFilter{
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceLocation"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("East US"),
to.Ptr("West Europe"),
},
},
},
{
Tags: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("Environment"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("UAT"),
to.Ptr("Prod"),
},
},
},
},
},
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceGroup"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("API"),
},
},
},
},
},
Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D"),
// Rows: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// 20180331,
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// 20180331,
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// 20180331,
// "USD",
// },
// []any{
// 0.16677720329728665,
// "gs-stms-dev",
// 20180331,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/MCABillingAccountQuery.json
func ExampleQueryClient_Usage_billingAccountQueryMca() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Filter: &armcostmanagement.QueryFilter{
And: []*armcostmanagement.QueryFilter{
{
Or: []*armcostmanagement.QueryFilter{
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceLocation"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("East US"),
to.Ptr("West Europe"),
},
},
},
{
Tags: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("Environment"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("UAT"),
to.Ptr("Prod"),
},
},
},
},
},
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceGroup"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("API"),
},
},
},
},
},
Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D"),
// Rows: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// 20180331,
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// 20180331,
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// 20180331,
// "USD",
// },
// []any{
// 0.16677720329728665,
// "gs-stms-dev",
// 20180331,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/BillingAccountQueryGrouping.json
func ExampleQueryClient_Usage_billingAccountQueryGroupingLegacy() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/70664866", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Aggregation: map[string]*armcostmanagement.QueryAggregation{
"totalCost": {
Name: to.Ptr("PreTaxCost"),
Function: to.Ptr(armcostmanagement.FunctionTypeSum),
},
},
Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
Grouping: []*armcostmanagement.QueryGrouping{
{
Name: to.Ptr("ResourceGroup"),
Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
},
},
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D"),
// Rows: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/MCABillingAccountQueryGrouping.json
func ExampleQueryClient_Usage_billingAccountQueryGroupingMca() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Aggregation: map[string]*armcostmanagement.QueryAggregation{
"totalCost": {
Name: to.Ptr("PreTaxCost"),
Function: to.Ptr(armcostmanagement.FunctionTypeSum),
},
},
Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
Grouping: []*armcostmanagement.QueryGrouping{
{
Name: to.Ptr("ResourceGroup"),
Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
},
},
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D"),
// Rows: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/MCABillingProfileQuery.json
func ExampleQueryClient_Usage_billingProfileQueryMca() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Filter: &armcostmanagement.QueryFilter{
And: []*armcostmanagement.QueryFilter{
{
Or: []*armcostmanagement.QueryFilter{
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceLocation"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("East US"),
to.Ptr("West Europe"),
},
},
},
{
Tags: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("Environment"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("UAT"),
to.Ptr("Prod"),
},
},
},
},
},
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceGroup"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("API"),
},
},
},
},
},
Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("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: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// 20180331,
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// 20180331,
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// 20180331,
// "USD",
// },
// []any{
// 0.16677720329728665,
// "gs-stms-dev",
// 20180331,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/MCABillingProfileQueryGrouping.json
func ExampleQueryClient_Usage_billingProfileQueryGroupingMca() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Aggregation: map[string]*armcostmanagement.QueryAggregation{
"totalCost": {
Name: to.Ptr("PreTaxCost"),
Function: to.Ptr(armcostmanagement.FunctionTypeSum),
},
},
Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
Grouping: []*armcostmanagement.QueryGrouping{
{
Name: to.Ptr("ResourceGroup"),
Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
},
},
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("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: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/MCACustomerQuery.json
func ExampleQueryClient_Usage_customerQueryMca() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Filter: &armcostmanagement.QueryFilter{
And: []*armcostmanagement.QueryFilter{
{
Or: []*armcostmanagement.QueryFilter{
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceLocation"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("East US"),
to.Ptr("West Europe"),
},
},
},
{
Tags: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("Environment"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("UAT"),
to.Ptr("Prod"),
},
},
},
},
},
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceGroup"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("API"),
},
},
},
},
},
Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("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: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// 20180331,
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// 20180331,
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// 20180331,
// "USD",
// },
// []any{
// 0.16677720329728665,
// "gs-stms-dev",
// 20180331,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/MCACustomerQueryGrouping.json
func ExampleQueryClient_Usage_customerQueryGroupingMca() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Aggregation: map[string]*armcostmanagement.QueryAggregation{
"totalCost": {
Name: to.Ptr("PreTaxCost"),
Function: to.Ptr(armcostmanagement.FunctionTypeSum),
},
},
Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
Grouping: []*armcostmanagement.QueryGrouping{
{
Name: to.Ptr("ResourceGroup"),
Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
},
},
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("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: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/DepartmentQuery.json
func ExampleQueryClient_Usage_departmentQueryLegacy() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/100/departments/123", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Filter: &armcostmanagement.QueryFilter{
And: []*armcostmanagement.QueryFilter{
{
Or: []*armcostmanagement.QueryFilter{
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceLocation"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("East US"),
to.Ptr("West Europe"),
},
},
},
{
Tags: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("Environment"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("UAT"),
to.Ptr("Prod"),
},
},
},
},
},
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceGroup"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("API"),
},
},
},
},
},
Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/70664866/departments/123/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("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: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// 20180331,
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// 20180331,
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// 20180331,
// "USD",
// },
// []any{
// 0.16677720329728665,
// "gs-stms-dev",
// 20180331,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/DepartmentQueryGrouping.json
func ExampleQueryClient_Usage_departmentQueryGroupingLegacy() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/100/departments/123", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Aggregation: map[string]*armcostmanagement.QueryAggregation{
"totalCost": {
Name: to.Ptr("PreTaxCost"),
Function: to.Ptr(armcostmanagement.FunctionTypeSum),
},
},
Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
Grouping: []*armcostmanagement.QueryGrouping{
{
Name: to.Ptr("ResourceGroup"),
Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
},
},
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/70664866/departments/123/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("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: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/EnrollmentAccountQuery.json
func ExampleQueryClient_Usage_enrollmentAccountQueryLegacy() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Filter: &armcostmanagement.QueryFilter{
And: []*armcostmanagement.QueryFilter{
{
Or: []*armcostmanagement.QueryFilter{
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceLocation"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("East US"),
to.Ptr("West Europe"),
},
},
},
{
Tags: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("Environment"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("UAT"),
to.Ptr("Prod"),
},
},
},
},
},
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceGroup"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("API"),
},
},
},
},
},
Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/70664866/enrollmentAccounts/456/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("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: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// 20180331,
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// 20180331,
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// 20180331,
// "USD",
// },
// []any{
// 0.16677720329728665,
// "gs-stms-dev",
// 20180331,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/EnrollmentAccountQueryGrouping.json
func ExampleQueryClient_Usage_enrollmentAccountQueryGroupingLegacy() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Aggregation: map[string]*armcostmanagement.QueryAggregation{
"totalCost": {
Name: to.Ptr("PreTaxCost"),
Function: to.Ptr(armcostmanagement.FunctionTypeSum),
},
},
Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
Grouping: []*armcostmanagement.QueryGrouping{
{
Name: to.Ptr("ResourceGroup"),
Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
},
},
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/70664866/enrollmentAccounts/456/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("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: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// 20180331,
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// 20180331,
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// 20180331,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/MCAInvoiceSectionQuery.json
func ExampleQueryClient_Usage_invoiceSectionQueryMca() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Filter: &armcostmanagement.QueryFilter{
And: []*armcostmanagement.QueryFilter{
{
Or: []*armcostmanagement.QueryFilter{
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceLocation"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("East US"),
to.Ptr("West Europe"),
},
},
},
{
Tags: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("Environment"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("UAT"),
to.Ptr("Prod"),
},
},
},
},
},
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceGroup"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("API"),
},
},
},
},
},
Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("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: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// 20180331,
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// 20180331,
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// 20180331,
// "USD",
// },
// []any{
// 0.16677720329728665,
// "gs-stms-dev",
// 20180331,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/MCAInvoiceSectionQueryGrouping.json
func ExampleQueryClient_Usage_invoiceSectionQueryGroupingMca() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Aggregation: map[string]*armcostmanagement.QueryAggregation{
"totalCost": {
Name: to.Ptr("PreTaxCost"),
Function: to.Ptr(armcostmanagement.FunctionTypeSum),
},
},
Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
Grouping: []*armcostmanagement.QueryGrouping{
{
Name: to.Ptr("ResourceGroup"),
Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
},
},
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("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: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/ManagementGroupQuery.json
func ExampleQueryClient_Usage_managementGroupQueryLegacy() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Management/managementGroups/MyMgId", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Filter: &armcostmanagement.QueryFilter{
And: []*armcostmanagement.QueryFilter{
{
Or: []*armcostmanagement.QueryFilter{
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceLocation"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("East US"),
to.Ptr("West Europe"),
},
},
},
{
Tags: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("Environment"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("UAT"),
to.Ptr("Prod"),
},
},
},
},
},
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceGroup"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("API"),
},
},
},
},
},
Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("https://management.azure.com/providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D"),
// Rows: [][]any{
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// 20180331,
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// 20180331,
// "USD",
// },
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// 20180331,
// "USD",
// },
// []any{
// 0.16677720329728665,
// "gs-stms-dev",
// 20180331,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/ManagementGroupQueryGrouping.json
func ExampleQueryClient_Usage_managementGroupQueryGroupingLegacy() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Management/managementGroups/MyMgId", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Aggregation: map[string]*armcostmanagement.QueryAggregation{
"totalCost": {
Name: to.Ptr("PreTaxCost"),
Function: to.Ptr(armcostmanagement.FunctionTypeSum),
},
},
Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
Grouping: []*armcostmanagement.QueryGrouping{
{
Name: to.Ptr("ResourceGroup"),
Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
},
},
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// NextLink: to.Ptr("https://management.azure.com/providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/Query?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D"),
// Rows: [][]any{
// []any{
// 20.35941656262545,
// "VSTSHOL-1595322048000",
// 20180331,
// "USD",
// },
// []any{
// 173.41979241290323,
// "RVIIOT-TRIAL",
// 20180331,
// "USD",
// },
// []any{
// 19.545363672276512,
// "JapanUnifia-Trial",
// 20180331,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/ResourceGroupQuery.json
func ExampleQueryClient_Usage_resourceGroupQueryLegacy() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Filter: &armcostmanagement.QueryFilter{
And: []*armcostmanagement.QueryFilter{
{
Or: []*armcostmanagement.QueryFilter{
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceLocation"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("East US"),
to.Ptr("West Europe"),
},
},
},
{
Tags: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("Environment"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("UAT"),
to.Ptr("Prod"),
},
},
},
},
},
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceGroup"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("API"),
},
},
},
},
},
Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("9af9459d-441d-4055-9ed0-83d4c4a363fb"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/subscriptions/55312978-ba1b-415c-9304-c4b9c43c0481/resourcegroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/Query/9af9459d-441d-4055-9ed0-83d4c4a363fb"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// Rows: [][]any{
// []any{
// 2.10333307059661,
// "ScreenSharingTest-peer",
// 20180417,
// "USD",
// },
// []any{
// 20.10333307059661,
// "ScreenSharingTest-peer",
// 20180418,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/ResourceGroupQueryGrouping.json
func ExampleQueryClient_Usage_resourceGroupQueryGroupingLegacy() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Aggregation: map[string]*armcostmanagement.QueryAggregation{
"totalCost": {
Name: to.Ptr("PreTaxCost"),
Function: to.Ptr(armcostmanagement.FunctionTypeSum),
},
},
Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
Grouping: []*armcostmanagement.QueryGrouping{
{
Name: to.Ptr("ResourceType"),
Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
},
},
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("9af9459d-441d-4055-9ed0-83d4c4a363fb"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/Query/9af9459d-441d-4055-9ed0-83d4c4a363fb"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceType"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// Rows: [][]any{
// []any{
// 2.10333307059661,
// "Microsoft.SqlServer",
// 20180417,
// "USD",
// },
// []any{
// 20.10333307059661,
// "Microsoft.Compute",
// 20180418,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/SubscriptionQuery.json
func ExampleQueryClient_Usage_subscriptionQueryLegacy() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Filter: &armcostmanagement.QueryFilter{
And: []*armcostmanagement.QueryFilter{
{
Or: []*armcostmanagement.QueryFilter{
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceLocation"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("East US"),
to.Ptr("West Europe"),
},
},
},
{
Tags: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("Environment"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("UAT"),
to.Ptr("Prod"),
},
},
},
},
},
{
Dimensions: &armcostmanagement.QueryComparisonExpression{
Name: to.Ptr("ResourceGroup"),
Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
Values: []*string{
to.Ptr("API"),
},
},
},
},
},
Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("55312978-ba1b-415c-9304-cfd9c43c0481"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/Query/00000000-0000-0000-0000-000000000000"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("UsageDate"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// Rows: [][]any{
// []any{
// 2.10333307059661,
// "ScreenSharingTest-peer",
// 20180331,
// "USD",
// },
// []any{
// 218.68795741935486,
// "Ict_StratAndPlan_GoldSprova_Prod",
// 20180331,
// "USD",
// },
// []any{
// 0.14384913581657052,
// "ssbciotelement01",
// 20180401,
// "USD",
// },
// []any{
// 0.009865586851323632,
// "ict_stratandplan_goldsprova_prod",
// 20180429,
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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
Sample request
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"
}
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/SubscriptionQueryGrouping.json
func ExampleQueryClient_Usage_subscriptionQueryGroupingLegacy() {
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)
}
res, err := clientFactory.NewQueryClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", armcostmanagement.QueryDefinition{
Type: to.Ptr(armcostmanagement.ExportTypeUsage),
Dataset: &armcostmanagement.QueryDataset{
Aggregation: map[string]*armcostmanagement.QueryAggregation{
"totalCost": {
Name: to.Ptr("PreTaxCost"),
Function: to.Ptr(armcostmanagement.FunctionTypeSum),
},
},
Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
Grouping: []*armcostmanagement.QueryGrouping{
{
Name: to.Ptr("ResourceGroup"),
Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
},
},
},
Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.QueryClientUsageResponse{
// QueryResult: armcostmanagement.QueryResult{
// Name: to.Ptr("55312978-ba1b-415c-9304-cfd9c43c0481"),
// Type: to.Ptr("microsoft.costmanagement/Query"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/Query/00000000-0000-0000-0000-000000000000"),
// Properties: &armcostmanagement.QueryProperties{
// Columns: []*armcostmanagement.QueryColumn{
// {
// Name: to.Ptr("PreTaxCost"),
// Type: to.Ptr("Number"),
// },
// {
// Name: to.Ptr("ResourceGroup"),
// Type: to.Ptr("String"),
// },
// {
// Name: to.Ptr("Currency"),
// Type: to.Ptr("String"),
// },
// },
// Rows: [][]any{
// []any{
// 0.009865586851323632,
// "Ict_StratAndPlan_GoldSprova_Prod_0",
// "USD",
// },
// []any{
// 218.68795741935486,
// "Ict_StratAndPlan_GoldSprova_Prod_1",
// "USD",
// },
// []any{
// 2.10333307059661,
// "ScreenSharingTest-peer1",
// "USD",
// },
// []any{
// 0.14384913581657052,
// "Ssbciotelement01",
// "USD",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"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"
]
]
}
}
Definitions
| Name |
Description |
|
ErrorDetails
|
The details of the error.
|
|
ErrorResponse
|
Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. \n\nSome Error responses: \n\n * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header. \n\n * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header.
|
|
ExportType
|
The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations.
|
|
FunctionType
|
The name of the aggregation function to use.
|
|
GranularityType
|
The granularity of rows in the export. Currently 'Daily' is supported for most cases.
|
|
QueryAggregation
|
The aggregation expression to be used in the query.
|
|
QueryColumn
|
QueryColumn properties
|
|
QueryColumnType
|
The type of the column in the report.
|
|
QueryComparisonExpression
|
The comparison expression to be used in the query.
|
|
QueryDataset
|
The definition of data present in the query.
|
|
QueryDatasetConfiguration
|
The configuration of dataset in the query.
|
|
QueryDefinition
|
The definition of a query.
|
|
QueryFilter
|
The filter expression to be used in the export.
|
|
QueryGrouping
|
The group by expression to be used in the query.
|
|
QueryOperatorType
|
The operator to use for comparison.
|
|
QueryResult
|
Result of query. It contains all columns listed under groupings and aggregation.
|
|
QueryTimePeriod
|
The start and end date for pulling data for the query.
|
|
TimeframeType
|
The time frame for pulling data for the export. If custom, then a specific time period must be provided.
|
ErrorDetails
Object
The details of the error.
| Name |
Type |
Description |
|
code
|
string
|
Error code.
|
|
message
|
string
|
Error message indicating why the operation failed.
|
ErrorResponse
Object
Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. \n\nSome Error responses: \n\n * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header. \n\n * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header.
| Name |
Type |
Description |
|
error
|
ErrorDetails
|
The details of the error.
|
ExportType
Enumeration
The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations.
| Value |
Description |
|
Usage
|
|
|
ActualCost
|
|
|
AmortizedCost
|
|
|
FocusCost
|
|
|
PriceSheet
|
|
|
ReservationTransactions
|
|
|
ReservationRecommendations
|
|
|
ReservationDetails
|
|
FunctionType
Enumeration
The name of the aggregation function to use.
GranularityType
Enumeration
The granularity of rows in the export. Currently 'Daily' is supported for most cases.
| Value |
Description |
|
Daily
|
|
|
Monthly
|
|
QueryAggregation
Object
The aggregation expression to be used in the query.
| Name |
Type |
Description |
|
function
|
FunctionType
|
The name of the aggregation function to use.
|
|
name
|
string
|
The name of the column to aggregate.
|
QueryColumn
Object
QueryColumn properties
| Name |
Type |
Description |
|
name
|
string
|
The name of column.
|
|
type
|
string
|
The type of column.
|
QueryColumnType
Enumeration
The type of the column in the report.
| Value |
Description |
|
TagKey
|
The tag associated with the cost data.
|
|
Dimension
|
The dimension of cost data.
|
QueryComparisonExpression
Object
The comparison expression to be used in the query.
| Name |
Type |
Description |
|
name
|
string
|
The name of the column to use in comparison.
|
|
operator
|
QueryOperatorType
|
The operator to use for comparison.
|
|
values
|
string[]
|
Array of values to use for comparison
|
QueryDataset
Object
The definition of data present in the query.
| Name |
Type |
Description |
|
aggregation
|
<string,
QueryAggregation>
|
Dictionary of aggregation expression to use in the query. The key of each item in the dictionary is the alias for the aggregated column. Query can have up to 2 aggregation clauses.
|
|
configuration
|
QueryDatasetConfiguration
|
Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.
|
|
filter
|
QueryFilter
|
The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format the filter.
|
|
granularity
|
GranularityType
|
The granularity of rows in the query.
|
|
grouping
|
QueryGrouping[]
|
Array of group by expression to use in the query. Query can have up to 2 group by clauses.
|
QueryDatasetConfiguration
Object
The configuration of dataset in the query.
| Name |
Type |
Description |
|
columns
|
string[]
|
Array of column names to be included in the query. Any valid query column name is allowed. If not provided, then query includes all columns.
|
QueryDefinition
Object
The definition of a query.
| Name |
Type |
Description |
|
dataset
|
QueryDataset
|
Has definition for data in this query.
|
|
timePeriod
|
QueryTimePeriod
|
Has time period for pulling data for the query.
|
|
timeframe
|
TimeframeType
|
The time frame for pulling data for the query. If custom, then a specific time period must be provided.
|
|
type
|
ExportType
|
The type of the query.
|
QueryFilter
Object
The filter expression to be used in the export.
QueryGrouping
Object
The group by expression to be used in the query.
| Name |
Type |
Description |
|
name
|
string
|
The name of the column to group.
|
|
type
|
QueryColumnType
|
Has type of the column to group.
|
QueryOperatorType
Enumeration
The operator to use for comparison.
QueryResult
Object
Result of query. It contains all columns listed under groupings and aggregation.
| Name |
Type |
Description |
|
eTag
|
string
|
ETag of the resource.
|
|
id
|
string
|
Resource Id.
|
|
location
|
string
|
Location of the resource.
|
|
name
|
string
|
Resource name.
|
|
properties.columns
|
QueryColumn[]
|
Array of columns
|
|
properties.nextLink
|
string
|
The link (url) to the next page of results.
|
|
properties.rows
|
Rows[]
|
Array of rows
|
|
sku
|
string
|
SKU of the resource.
|
|
tags
|
object
|
Resource tags.
|
|
type
|
string
|
Resource type.
|
QueryTimePeriod
Object
The start and end date for pulling data for the query.
| Name |
Type |
Description |
|
from
|
string
(date-time)
|
The start date to pull data from.
|
|
to
|
string
(date-time)
|
The end date to pull data to.
|
TimeframeType
Enumeration
The time frame for pulling data for the export. If custom, then a specific time period must be provided.
| Value |
Description |
|
MonthToDate
|
|
|
BillingMonthToDate
|
|
|
TheLastMonth
|
|
|
TheLastBillingMonth
|
|
|
WeekToDate
|
|
|
Custom
|
|
|
TheCurrentMonth
|
|