az costmanagement export

注意

此參考是 Azure CLI 成本管理延伸模組的一部分(2.55.0 版或更高版本)。 擴充功能會在您第一次執行 az costmanagement export 命令時自動安裝。 深入了解擴充功能。

Costmanagement 導出。

命令

名稱 Description 類型 狀態
az costmanagement export create

建立導出的作業。

副檔名 GA
az costmanagement export delete

要刪除匯出的作業。

副檔名 GA
az costmanagement export list

列出指定範圍內所有導出的作業。

副檔名 GA
az costmanagement export show

依匯出名稱取得所定義範圍之匯出執行歷程記錄的作業。

副檔名 GA
az costmanagement export update

更新導出的作業。

副檔名 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}/' 、資源群組範圍的 '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'、'/providers/Microsoft.Management/managementGroups/{managementGroupId} 。

--storage-account-id

要儲存導出的記憶體帳戶標識碼。

--storage-container

要傳遞導出的記憶體容器。

--timeframe

提取查詢數據的時間範圍。 如果為 custom,則必須提供特定的時間週期。

接受的值: BillingMonthToDate, Custom, MonthToDate, TheLastBillingMonth, TheLastMonth, WeekToDate

選擇性參數

--dataset-configuration

具有匯出中數據的組態資訊。 如果提供匯總和群組,將會忽略組態。 預期值:columns=xx。

--recurrence

排程週期。

接受的值: Annually, Daily, Monthly, Weekly
--recurrence-period

具有周期的開始和結束日期。 開始日期必須在未來。 如果存在,結束日期必須大於開始日期。 預期值:KEY1=VALUE1 KEY2=VALUE2 ... ,可用的 KEY 是:from、 to。 時間格式就像 2020-05-01T00:00:00。

--schedule-status

匯出排程的狀態。 如果非使用中,導出的排程執行會暫停。

接受的值: Active, Inactive
預設值: Inactive
--storage-directory

要儲存匯出之記憶體容器中的根目錄。

--time-period

有提取查詢數據的時間週期。 預期值:from=TIMESTAMP1 to=TIMESTAMP2。 時間戳格式就像 2020-05-01T00:00:00。未來必須有TIMESTAMP1,TIMESTAMP2必須大於TIMESTAMP1。

--type

查詢的類型。

接受的值: ActualCost, AmortizedCost, Usage
預設值: Usage
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

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}/' 、資源群組範圍的 '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'、'/providers/Microsoft.Management/managementGroups/{managementGroupId} 。

選擇性參數

--yes -y

不提示確認。

預設值: False
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

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}/' 、資源群組範圍的 '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'、'/providers/Microsoft.Management/managementGroups/{managementGroupId} 。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

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}/' 、資源群組範圍的 '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'、'/providers/Microsoft.Management/managementGroups/{managementGroupId} 。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

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}/' 、資源群組範圍的 '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'、'/providers/Microsoft.Management/managementGroups/{managementGroupId} 。

選擇性參數

--dataset-configuration

具有匯出中數據的組態資訊。 如果提供匯總和群組,將會忽略組態。 預期值:columns=xx。

--recurrence

排程週期。

接受的值: Annually, Daily, Monthly, Weekly
--recurrence-period

具有周期的開始和結束日期。 開始日期必須在未來。 如果存在,結束日期必須大於開始日期。 預期值:KEY1=VALUE1 KEY2=VALUE2 ... ,可用的 KEY 是:from、 to。 時間格式就像 2020-05-01T00:00:00。

--schedule-status

匯出排程的狀態。 如果非使用中,導出的排程執行會暫停。

接受的值: Active, Inactive
--storage-account-id

要儲存導出的記憶體帳戶標識碼。

--storage-container

要傳遞導出的記憶體容器。

--storage-directory

要儲存匯出之記憶體容器中的根目錄。

--time-period

有提取查詢數據的時間週期。 預期值:from=TIMESTAMP1 to=TIMESTAMP2。 時間戳格式就像 2020-05-01T00:00:00。未來必須有TIMESTAMP1,TIMESTAMP2必須大於TIMESTAMP1。

--timeframe

提取查詢數據的時間範圍。 如果為 custom,則必須提供特定的時間週期。

接受的值: BillingMonthToDate, Custom, MonthToDate, TheLastBillingMonth, TheLastMonth, WeekToDate
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。