az carbon
Note
此参考是 Azure CLI(版本 2.70.0 或更高版本)的 碳 扩展的一部分。 该扩展将在首次运行 az carbon 命令时自动安装。 了解更多关于扩展的信息。
管理碳。
命令
| 名称 | 说明 | 类型 | Status |
|---|---|---|---|
| az carbon get-emission-data-available-date-range |
用于查询碳排放数据的 API 可用日期范围。 |
Extension | GA |
| az carbon get-emission-report |
用于碳排放报告的 API。 |
Extension | GA |
az carbon get-emission-data-available-date-range
用于查询碳排放数据的 API 可用日期范围。
az carbon get-emission-data-available-date-range
示例
查询碳排放数据可用日期范围
az carbon get-emission-data-available-date-range
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
只显示错误,取消显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az carbon get-emission-report
用于碳排放报告的 API。
az carbon get-emission-report --carbon-scope-list
--date-range
--subscription-list
[--item-details]
[--location-list]
[--monthly-summary]
[--overall-summary]
[--resource-group-urls]
[--resource-type-list]
[--top-items-monthly]
[--top-items-summary]
示例
QueryQueryEmission 总体摘要报告
az carbon get-emission-report --subscription-list "[00000000-0000-0000-0000-000000000000]" --carbon-scope-list "[Scope1,Scope2,Scope3]" --date-range "{start:2024-03-01,end:2025-03-01}" --overall-summary
QueryQueryEmission 每月摘要报告
az carbon get-emission-report --subscription-list "[00000000-0000-0000-0000-000000000000]" --carbon-scope-list "[Scope1,Scope2,Scope3]" --date-range "{start:2024-03-01,end:2025-03-01}" --monthly-summary
QueryQueryEmission 项详细信息报告
az carbon get-emission-report --subscription-list "[00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000001]" --carbon-scope-list "[Scope1,Scope2,Scope3]" --date-range "{start:2025-03-01,end:2025-03-01}" --item-details "{category-type:ResourceType,order-by:itemName,page-size:10,sort-direction:asc}"
QueryQueryEmission Top Items Summary Report
az carbon get-emission-report --subscription-list "[00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000001]" --carbon-scope-list "[Scope1,Scope2,Scope3]" --date-range "{start:2025-03-01,end:2025-03-01}" --top-items-summary "{category-type:ResourceType,top-items:5}"
QueryTop Items Monthly Summary Report
az carbon get-emission-report --subscription-list "[00000000-0000-0000-0000-000000000000]" --carbon-scope-list "[Scope1,Scope2,Scope3]" --date-range "{start:2024-03-01,end:2025-03-01}" --top-items-monthly "{category-type:ResourceType,top-items:5}
必需参数
碳排放范围列表。 Required. 接受来自 EmissionScopeEnum 的一个或多个值(例如 Scope1、Scope2、Scope3)的列表窗体。 输出将包括指定范围的总排放量。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | QueryParameters Arguments |
碳排放数据的开始日期和结束日期。 Required. 对于 ItemDetailsReport 和 TopItemsSummaryReport,一次仅支持一个月的数据,因此开始日期和结束日期应在 DateRange 内相等(例如,start: 2024-06-01 和 end: 2024-06-01)。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | QueryParameters Arguments |
请求其碳排放数据的订阅 ID 列表。 Required. 每个订阅 ID 应采用小写格式。 列表的最大长度为 100。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | QueryParameters Arguments |
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
使用此选项可获取项详细信息报表支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | QueryParameters Arguments |
碳排放数据的位置列表(Azure 区域显示名称),每个位置都用小写(例如,“美国东部”)指定。 Optional. 可以使用命令“az account list-locations -o table”查找 Azure 区域显示名称。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | QueryParameters Arguments |
使用此选项可获取每月摘要报告支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | QueryParameters Arguments |
使用此选项可获取总体摘要报告支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | QueryParameters Arguments |
碳排放数据的资源组 URL 列表。 Optional. 每个 URL 必须遵循格式“/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}”,并且应全部采用小写形式。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | QueryParameters Arguments |
碳排放数据的资源类型列表。 Optional. 应以小写形式指定每个资源类型,格式为“microsoft”。{service}/{resourceType}“,例如”microsoft.storage/storageaccounts”。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | QueryParameters Arguments |
使用此选项可获取 Top Items Monthly Summary Report Support 速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | QueryParameters Arguments |
使用此选项可获取热门项摘要报表支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | QueryParameters Arguments |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
只显示错误,取消显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |