Share via


az costmanagement export

Note

This reference is part of the costmanagement extension for the Azure CLI (version 2.55.0 or higher). The extension will automatically install the first time you run an az costmanagement export command. Learn more about extensions.

Costmanagement export.

Commands

Name Description Type Status
az costmanagement export create

The operation to create an export.

Extension GA
az costmanagement export delete

The operation to delete an export.

Extension GA
az costmanagement export list

The operation to list all exports at the given scope.

Extension GA
az costmanagement export show

The operation to get the execution history of an export for the defined scope by export name.

Extension GA
az costmanagement export update

The operation to update an export.

Extension GA

az costmanagement export create

The operation to create an export.

az costmanagement export create --name
                                --scope
                                --storage-account-id
                                --storage-container
                                --timeframe {BillingMonthToDate, Custom, MonthToDate, TheLastBillingMonth, TheLastMonth, WeekToDate}
                                [--dataset-configuration]
                                [--recurrence {Annually, Daily, Monthly, Weekly}]
                                [--recurrence-period]
                                [--schedule-status {Active, Inactive}]
                                [--storage-directory]
                                [--time-period]
                                [--type {ActualCost, AmortizedCost, Usage}]

Examples

Create an export for ManagementGroup scope

az costmanagement export create --name "TestExport" --type "Usage" --dataset-configuration columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --timeframe "MonthToDate" --storage-container="exports" --storage-account-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182" --storage-directory="ad-hoc" --recurrence "Weekly" --recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "providers/Microsoft.Management/managementGroups/TestMG"

Create an export for ResourceGroup scope

az costmanagement export create --name "TestExport" --type "Usage" --dataset-configuration columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --timeframe "MonthToDate" --storage-container="exports" --storage-account-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182" --storage-directory="ad-hoc" --recurrence "Weekly" --recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"

Create an export for Subscription scope

az costmanagement export create --name "TestExport" --type "Usage" --dataset-configuration columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --timeframe "MonthToDate" --storage-container="exports" --storage-account-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182" --storage-directory="ad-hoc" --recurrence "Weekly" --recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "subscriptions/00000000-0000-0000-0000-000000000000"

Required Parameters

--name

Export Name.

--scope

The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope.

--storage-account-id

The ID of the storage account to store exports.

--storage-container

The storage container to deliver exports.

--timeframe

The time frame for pulling data for the query. If custom, then a specific time period must be provided.

Accepted values: BillingMonthToDate, Custom, MonthToDate, TheLastBillingMonth, TheLastMonth, WeekToDate

Optional Parameters

--dataset-configuration

Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided. Expect value: columns=xx.

--recurrence

The schedule recurrence.

Accepted values: Annually, Daily, Monthly, Weekly
--recurrence-period

Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than start date. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: from, to. The time format is like 2020-05-01T00:00:00.

--schedule-status

The status of the export's schedule. If inactive, the export's scheduled execution is paused.

Accepted values: Active, Inactive
Default value: Inactive
--storage-directory

The root directory in the storage container to store exports.

--time-period

Has time period for pulling data for the query. Expect value: from=TIMESTAMP1 to=TIMESTAMP2. The timestamp format is like 2020-05-01T00:00:00.The TIMESTAMP1 must in the future and TIMESTAMP2 must be greater than TIMESTAMP1.

--type

The type of the query.

Accepted values: ActualCost, AmortizedCost, Usage
Default value: Usage
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az costmanagement export delete

The operation to delete an export.

az costmanagement export delete --name
                                --scope
                                [--yes]

Examples

delete an export for a ManagementGroup scope

az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Management/managementGroups/TestMG"

delete an export for ResourceGroup scope

az costmanagement export delete --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"

delete an export for Subscription scope

az costmanagement export delete --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-000000000000"

Required Parameters

--name

Export Name.

--scope

The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope.

Optional Parameters

--yes -y

Do not prompt for confirmation.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az costmanagement export list

The operation to list all exports at the given scope.

az costmanagement export list --scope

Examples

list exports in a ManagementGroup scope

az costmanagement export list --scope "providers/Microsoft.Management/managementGroups/TestMG"

list exports in a ResourceGroup scope

az costmanagement export list --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"

list exports in a Subscription scope

az costmanagement export list --scope "subscriptions/00000000-0000-0000-0000-000000000000"

Required Parameters

--scope

The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az costmanagement export show

The operation to get the execution history of an export for the defined scope by export name.

az costmanagement export show --name
                              --scope

Examples

Show an export in a ManagementGroup scope

az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Management/managementGroups/TestMG"

Show an export in a ResourceGroup scope

az costmanagement export show --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"

Show an export in a Subscription scope

az costmanagement export show --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-000000000000"

Required Parameters

--name

Export Name.

--scope

The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az costmanagement export update

The operation to update an export.

az costmanagement export update --name
                                --scope
                                [--dataset-configuration]
                                [--recurrence {Annually, Daily, Monthly, Weekly}]
                                [--recurrence-period]
                                [--schedule-status {Active, Inactive}]
                                [--storage-account-id]
                                [--storage-container]
                                [--storage-directory]
                                [--time-period]
                                [--timeframe {BillingMonthToDate, Custom, MonthToDate, TheLastBillingMonth, TheLastMonth, WeekToDate}]

Examples

Update an export in a ManagementGroup scope

az costmanagement export update --name "TestExport" --dataset-configuration columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --timeframe "MonthToDate" --storage-container="exports" --storage-account-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182" --storage-directory="ad-hoc" --recurrence "Weekly" --recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "providers/Microsoft.Management/managementGroups/TestMG"

Update an export in a ResourceGroup scope

az costmanagement export update --name "TestExport" --dataset-configuration columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --timeframe "MonthToDate" --storage-container="exports" --storage-account-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182" --storage-directory="ad-hoc" --recurrence "Weekly" --recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"

Update an export in a Subscription scope

az costmanagement export update --name "TestExport" --dataset-configuration columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --timeframe "MonthToDate" --storage-container="exports" --storage-account-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182" --storage-directory="ad-hoc" --recurrence "Weekly" --recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "subscriptions/00000000-0000-0000-0000-000000000000"

Required Parameters

--name

Export Name.

--scope

The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope.

Optional Parameters

--dataset-configuration

Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided. Expect value: columns=xx.

--recurrence

The schedule recurrence.

Accepted values: Annually, Daily, Monthly, Weekly
--recurrence-period

Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than start date. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: from, to. The time format is like 2020-05-01T00:00:00.

--schedule-status

The status of the export's schedule. If inactive, the export's scheduled execution is paused.

Accepted values: Active, Inactive
--storage-account-id

The ID of the storage account to store exports.

--storage-container

The storage container to deliver exports.

--storage-directory

The root directory in the storage container to store exports.

--time-period

Has time period for pulling data for the query. Expect value: from=TIMESTAMP1 to=TIMESTAMP2. The timestamp format is like 2020-05-01T00:00:00.The TIMESTAMP1 must in the future and TIMESTAMP2 must be greater than TIMESTAMP1.

--timeframe

The time frame for pulling data for the query. If custom, then a specific time period must be provided.

Accepted values: BillingMonthToDate, Custom, MonthToDate, TheLastBillingMonth, TheLastMonth, WeekToDate
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.