你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az costmanagement export

Note

此参考是 Azure CLI(版本 2.55.0 或更高版本) 的成本管理 扩展的一部分。 该扩展将在首次运行 az costmanagement export 命令时自动安装。 了解更多关于扩展的信息。

Costmanagement 导出。

命令

名称 说明 类型 Status
az costmanagement export create

用于创建导出的作。

Extension GA
az costmanagement export delete

用于删除导出的作。

Extension GA
az costmanagement export list

列出给定范围内所有导出的作。

Extension GA
az costmanagement export show

通过导出名称获取定义的范围的导出的执行历史记录的操作。

Extension GA
az costmanagement export update

用于更新导出的作。

Extension GA

az costmanagement export create

用于创建导出的作。

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}]

示例

为 ManagementGroup 范围创建导出

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"

为 ResourceGroup 范围创建导出

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"

为订阅范围创建导出

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"

必需参数

--name

导出名称。

--scope

与查询和导出操作关联的范围。 这包括订阅范围的“/subscriptions/{subscriptionId}/”、resourceGroup 范围的“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}”、“/providers/Microsoft.Management/managementGroups/{managementGroupId}”,用于管理组范围。

--storage-account-id

用于存储导出的存储帐户的 ID。

属性
Parameter group: Delivery Destination Info Arguments
--storage-container

要传送导出的存储容器。

属性
Parameter group: Delivery Destination Info Arguments
--timeframe

为查询拉取数据的时间范围。 如果为自定义,则必须提供特定的时间段。

属性
Parameter group: Export Definition Arguments
接受的值: BillingMonthToDate, Custom, MonthToDate, TheLastBillingMonth, TheLastMonth, WeekToDate

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--dataset-configuration

为导出中的数据提供配置信息。 如果提供了聚合和分组,则会忽略配置。 预期值:columns=xx。

属性
Parameter group: Export Definition Arguments
--recurrence

计划重复周期。

属性
Parameter group: Schedule Info Arguments
接受的值: Annually, Daily, Monthly, Weekly
--recurrence-period

具有重复周期的开始和结束日期。 开始日期必须在将来。 如果存在,则结束日期必须大于开始日期。 预期值:KEY1=VALUE1 KEY2=VALUE2 ... ,可用的 KEY 是:从/ 到。 时间格式类似于 2020-05-01T00:00:00。

属性
Parameter group: Schedule Info Arguments
--schedule-status

导出计划的状态。 如果处于非活动状态,导出的计划执行将暂停。

属性
Parameter group: Schedule Info Arguments
默认值: Inactive
接受的值: Active, Inactive
--storage-directory

存储容器中用于存储导出的根目录。

属性
Parameter group: Delivery Destination Info Arguments
--time-period

有用于拉取查询数据的时间段。 预期值:from=TIMESTAMP1 to=TIMESTAMP2。 时间戳格式类似于 2020-05-01T00:00:00。TIMESTAMP1必须在未来,并且TIMESTAMP2必须大于TIMESTAMP1。

属性
Parameter group: Export Definition Arguments
--type

查询的类型。

属性
Parameter group: Export Definition Arguments
默认值: Usage
接受的值: ActualCost, AmortizedCost, Usage
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az costmanagement export delete

用于删除导出的作。

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

示例

删除 ManagementGroup 范围的导出

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

删除 ResourceGroup 范围的导出

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

删除订阅范围的导出

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

必需参数

--name

导出名称。

--scope

与查询和导出操作关联的范围。 这包括订阅范围的“/subscriptions/{subscriptionId}/”、resourceGroup 范围的“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}”、“/providers/Microsoft.Management/managementGroups/{managementGroupId}”,用于管理组范围。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--yes -y

不要提示确认。

属性
默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az costmanagement export list

列出给定范围内所有导出的作。

az costmanagement export list --scope

示例

列出 ManagementGroup 范围内的导出

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

列出 ResourceGroup 范围内的导出

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

列出订阅范围内的导出

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

必需参数

--scope

与查询和导出操作关联的范围。 这包括订阅范围的“/subscriptions/{subscriptionId}/”、resourceGroup 范围的“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}”、“/providers/Microsoft.Management/managementGroups/{managementGroupId}”,用于管理组范围。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az costmanagement export show

通过导出名称获取定义的范围的导出的执行历史记录的操作。

az costmanagement export show --name
                              --scope

示例

在 ManagementGroup 范围内显示导出

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

在 ResourceGroup 范围内显示导出

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

在订阅范围内显示导出

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

必需参数

--name

导出名称。

--scope

与查询和导出操作关联的范围。 这包括订阅范围的“/subscriptions/{subscriptionId}/”、resourceGroup 范围的“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}”、“/providers/Microsoft.Management/managementGroups/{managementGroupId}”,用于管理组范围。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az costmanagement export update

用于更新导出的作。

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}]

示例

更新 ManagementGroup 范围内的导出

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"

更新 ResourceGroup 范围内的导出

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"

更新订阅范围内的导出

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"

必需参数

--name

导出名称。

--scope

与查询和导出操作关联的范围。 这包括订阅范围的“/subscriptions/{subscriptionId}/”、resourceGroup 范围的“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}”、“/providers/Microsoft.Management/managementGroups/{managementGroupId}”,用于管理组范围。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--dataset-configuration

为导出中的数据提供配置信息。 如果提供了聚合和分组,则会忽略配置。 预期值:columns=xx。

属性
Parameter group: Export Definition Arguments
--recurrence

计划重复周期。

属性
Parameter group: Schedule Info Arguments
接受的值: Annually, Daily, Monthly, Weekly
--recurrence-period

具有重复周期的开始和结束日期。 开始日期必须在将来。 如果存在,则结束日期必须大于开始日期。 预期值:KEY1=VALUE1 KEY2=VALUE2 ... ,可用的 KEY 是:从/ 到。 时间格式类似于 2020-05-01T00:00:00。

属性
Parameter group: Schedule Info Arguments
--schedule-status

导出计划的状态。 如果处于非活动状态,导出的计划执行将暂停。

属性
Parameter group: Schedule Info Arguments
接受的值: Active, Inactive
--storage-account-id

用于存储导出的存储帐户的 ID。

属性
Parameter group: Delivery Destination Info Arguments
--storage-container

要传送导出的存储容器。

属性
Parameter group: Delivery Destination Info Arguments
--storage-directory

存储容器中用于存储导出的根目录。

属性
Parameter group: Delivery Destination Info Arguments
--time-period

有用于拉取查询数据的时间段。 预期值:from=TIMESTAMP1 to=TIMESTAMP2。 时间戳格式类似于 2020-05-01T00:00:00。TIMESTAMP1必须在未来,并且TIMESTAMP2必须大于TIMESTAMP1。

属性
Parameter group: Export Definition Arguments
--timeframe

为查询拉取数据的时间范围。 如果为自定义,则必须提供特定的时间段。

属性
Parameter group: Export Definition Arguments
接受的值: BillingMonthToDate, Custom, MonthToDate, TheLastBillingMonth, TheLastMonth, WeekToDate
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False