az costmanagement

참고

이 참조는 Azure CLI 대한 costmanagement 확장의 일부이며 버전 2.3.1 이상이 필요합니다. az costmanagement 명령을 처음 실행할 때 확장이 자동으로 설치됩니다. 확장에 대해 자세히 알아보세요.

Azure에서 비용 및 청구를 관리합니다.

명령

az costmanagement export

Costmanagement 내보내기.

az costmanagement export create

내보내기를 만드는 작업입니다.

az costmanagement export delete

내보내기를 삭제하는 작업입니다.

az costmanagement export list

지정된 범위의 모든 내보내기를 나열하는 작업입니다.

az costmanagement export show

내보내기 이름으로 정의된 범위에 대한 내보내기의 실행 기록을 얻는 작업입니다.

az costmanagement export update

내보내기를 업데이트하는 작업입니다.

az costmanagement query

정의된 범위에 대한 사용량 현황 데이터를 쿼리합니다.

az costmanagement query

정의된 범위에 대한 사용량 현황 데이터를 쿼리합니다.

az costmanagement query --scope
                        --timeframe {BillingMonthToDate, Custom, MonthToDate, TheLastBillingMonth, TheLastMonth, WeekToDate}
                        --type {ActualCost, AmortizedCost, Usage}
                        [--dataset-aggregation]
                        [--dataset-configuration]
                        [--dataset-filter]
                        [--dataset-grouping]
                        [--time-period]

예제

ManagementGroup 범위의 쿼리

az costmanagement query --type "Usage" --dataset-filter "{\"and\":[{\"or\":[{\"dimension\":{\"name\":\"ResourceLocation\",\"operator\":\"In\",\"values\":[\"East US\",\"West Europe\"]}},{\"tag\":{\"name\":\"Environment\",\"operator\":\"In\",\"values\":[\"UAT\",\"Prod\"]}}]},{\"dimension\":{\"name\":\"ResourceGroup\",\"operator\":\"In\",\"values\":[\"API\"]}}]}" --timeframe "MonthToDate" --scope "providers/Microsoft.Management/managementGroups/MyMgId"

그룹링을 통한 ManagementGroupQuery 범위의 쿼리

az costmanagement query --type "Usage" --dataset-aggregation "{\"totalCost\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}}" --dataset-grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope "providers/Microsoft.Management/managementGroups/MyMgId"

ResourceGroup 범위의 쿼리

az costmanagement query --type "Usage" --dataset-filter "{\"and\":[{\"or\":[{\"dimension\":{\"name\":\"ResourceLocation\",\"operator\":\"In\",\"values\":[\"East US\",\"West Europe\"]}},{\"tag\":{\"name\":\"Environment\",\"operator\":\"In\",\"values\":[\"UAT\",\"Prod\"]}}]},{\"dimension\":{\"name\":\"ResourceGroup\",\"operator\":\"In\",\"values\":[\"API\"]}}]}" --timeframe "MonthToDate" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"

그룹화하여 ResourceGroupQuery 범위에서 쿼리

az costmanagement query --type "Usage" --dataset-aggregation "{\"totalCost\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}}" --dataset-grouping name="ResourceType" type="Dimension" --timeframe "TheLastMonth" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"

구독 범위의 쿼리

az costmanagement query --type "Usage" --dataset-filter "{\"and\":[{\"or\":[{\"dimension\":{\"name\":\"ResourceLocation\",\"operator\":\"In\",\"values\":[\"East US\",\"West Europe\"]}},{\"tag\":{\"name\":\"Environment\",\"operator\":\"In\",\"values\":[\"UAT\",\"Prod\"]}}]},{\"dimension\":{\"name\":\"ResourceGroup\",\"operator\":\"In\",\"values\":[\"API\"]}}]}" --timeframe "MonthToDate" --scope "subscriptions/00000000-0000-0000-0000-000000000000"

그룹화하여 구독 범위에서 쿼리

az costmanagement query --type "Usage" --dataset-aggregation "{\"totalCost\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}}" --dataset-grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope "subscriptions/00000000-0000-0000-0000-000000000000"

필수 매개 변수

--scope

쿼리 및 내보내기 작업과 연결된 범위입니다. 여기에는 구독 범위의 경우 "/subscriptions/{subscriptionId}/", resourceGroup 범위의 경우 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}", 관리 그룹 범위의 경우 "/providers/Microsoft.Management/managementGroups/{managementGroupId}"가 포함됩니다.

--timeframe

쿼리에 대한 데이터를 끌어와서 가져오기 위한 시간 프레임입니다. 사용자 지정인 경우 특정 기간을 제공해야 합니다.

허용되는 값: BillingMonthToDate, Custom, MonthToDate, TheLastBillingMonth, TheLastMonth, WeekToDate
--type

쿼리의 형식입니다.

허용되는 값: ActualCost, AmortizedCost, Usage

선택적 매개 변수

--dataset-aggregation

쿼리에 사용할 집계 식의 사전입니다. 사전에 있는 각 항목의 키는 집계된 열의 별칭입니다. 쿼리에는 최대 2개의 집계 절이 있을 수 있습니다. 예상 값: json-string/@json-file .

--dataset-configuration

내보내기에서 데이터에 대한 구성 정보를 줍니다. 집계 및 그룹화가 제공되면 구성이 무시됩니다. 예상 값: columns=xx.

--dataset-filter

쿼리에 사용할 필터 식이 있습니다. 예상 값: json-string/@json-file .

--dataset-grouping

쿼리에 사용할 group by 식의 배열입니다. 쿼리에는 최대 2개의 group by 절이 있을 수 있습니다. 예상 값: KEY1=VALUE1 KEY2=VALUE2 ... , 사용 가능한 KEY는 type, name입니다.

--time-period

쿼리에 대한 데이터를 끌어온 기간이 있습니다. 예상 값: from=TIMESTAMP1 to=TIMESTAMP2. 타임스탬프 형식은 2020-05-01T00:00:00과 같습니다.