Skip to main content

query

Creates, updates, deletes, gets or lists a query resource.

Overview

Namequery
TypeResource
Idazure.cost_management.query

Fields

The following fields are returned by SELECT queries:

SELECT not supported for this resource, use SHOW METHODS to view available operations for the resource.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
usageexecscope, type, timeframe, datasetQuery the usage data for scope defined.
usage_by_external_cloud_provider_typeexecexternal_cloud_provider_type, external_cloud_provider_id, type, timeframe, datasetQuery the usage data for external cloud provider type defined.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
external_cloud_provider_idstringThis can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. Required.
external_cloud_provider_typestringThe external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" and "externalBillingAccounts". Required.
scopestringThe 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. Required.

Lifecycle Methods

Query the usage data for scope defined.

EXEC azure.cost_management.query.usage 
@scope='{{ scope }}' --required
@@json=
'{
"type": "{{ type }}",
"timeframe": "{{ timeframe }}",
"timePeriod": "{{ timePeriod }}",
"dataset": "{{ dataset }}"
}'
;