Views - Create Or Update By Scope

ビューを作成または更新する操作。 更新操作では、要求で最新の eTag を設定する必要があります。 get 操作を実行することで、最新の eTag を取得できます。 作成操作には eTag は必要ありません。

PUT https://management.azure.com/{scope}/providers/Microsoft.CostManagement/views/{viewName}?api-version=2023-11-01

URI パラメーター

名前 / 必須 説明
scope
path True

string

ビュー操作に関連付けられているスコープ。 これには、サブスクリプション スコープの 'subscriptions/{subscriptionId}' が含まれます。 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccount スコープの enrollmentAccountId}'、BillingProfile スコープの場合は 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' (外部課金アカウント スコープの場合)、外部サブスクリプション スコープの場合は 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' です。

viewName
path True

string

ビューの名前

api-version
query True

string

この操作に使用する API バージョン。

要求本文

名前 必須 説明
properties.query.timeframe True

ReportTimeframeType

レポートのデータをプルする期間。 カスタムの場合は、特定の期間を指定する必要があります。

properties.query.type True

ReportType

レポートの種類。 使用状況は実際の使用状況を表し、予測は予測データを表し、UsageAndForecast は使用状況と予測データの両方を表します。 実際の使用状況と予測データは、日付に基づいて区別できます。

eTag

string

リソースの eTag。 同時更新シナリオを処理するために、このフィールドを使用して、ユーザーが最新バージョンを更新しているかどうかを判断します。

properties.accumulated

AccumulatedType

時間の経過に伴って累積されたコストを表示します。

properties.chart

ChartType

コスト分析のメイン ビューのグラフの種類。 必須。

properties.dateRange

string

現在のビューの日付範囲。

properties.displayName

string

ビューのユーザー入力名。 必須。

properties.kpis

KpiProperties[]

コスト分析 UI に表示する KPI の一覧。

properties.metric

MetricType

コストを表示するときに使用するメトリック。

properties.modifiedOn

string

ユーザーがこのビューを最後に変更した日付。

properties.pivots

PivotProperties[]

コスト分析 UI での 3 つのサブビューの構成。

properties.query.dataSet

ReportConfigDataset

このレポート構成にデータの定義があります。

properties.query.includeMonetaryCommitment

boolean

true の場合、レポートには年額コミットメントが含まれます。

properties.query.timePeriod

ReportConfigTimePeriod

レポートのデータをプルするための期間があります。

properties.scope

string

ビューを保存する Cost Management スコープ。 これには、サブスクリプション スコープの 'subscriptions/{subscriptionId}' が含まれます。 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccount スコープの enrollmentAccountId}'、BillingProfile スコープの場合は 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccount スコープの場合は externalBillingAccountName}'、ExternalSubscription スコープの場合は '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' です。

応答

名前 説明
200 OK

View

OK です。 要求は成功しました。

201 Created

View

作成されました。

Other Status Codes

ErrorResponse

操作に失敗した理由を説明するエラー応答。

セキュリティ

azure_auth

Azure Active Directory OAuth2 フロー。

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名前 説明
user_impersonation ユーザー アカウントの借用

ResourceGroupCreateOrUpdateView

Sample Request

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample?api-version=2023-11-01

{
  "eTag": "\"1d4ff9fe66f1d10\"",
  "properties": {
    "displayName": "swagger Example",
    "query": {
      "type": "Usage",
      "timeframe": "MonthToDate",
      "dataSet": {
        "granularity": "Daily",
        "aggregation": {
          "totalCost": {
            "name": "PreTaxCost",
            "function": "Sum"
          }
        },
        "grouping": [],
        "sorting": [
          {
            "direction": "Ascending",
            "name": "UsageDate"
          }
        ]
      }
    },
    "chart": "Table",
    "accumulated": "true",
    "metric": "ActualCost",
    "kpis": [
      {
        "type": "Forecast",
        "id": null,
        "enabled": true
      },
      {
        "type": "Budget",
        "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo",
        "enabled": true
      }
    ],
    "pivots": [
      {
        "type": "Dimension",
        "name": "ServiceName"
      },
      {
        "type": "Dimension",
        "name": "MeterCategory"
      },
      {
        "type": "TagKey",
        "name": "swaggerTagKey"
      }
    ]
  }
}

Sample Response

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample",
  "name": "swaggerExample",
  "type": "Microsoft.CostManagement/Views",
  "eTag": "\"1d4ffa5a9c2430c\"",
  "properties": {
    "displayName": "swagger Example",
    "scope": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG",
    "query": {
      "type": "Usage",
      "timeframe": "MonthToDate",
      "dataSet": {
        "granularity": "Daily",
        "aggregation": {
          "totalCost": {
            "name": "PreTaxCost",
            "function": "Sum"
          }
        },
        "grouping": [],
        "sorting": [
          {
            "direction": "Ascending",
            "name": "UsageDate"
          }
        ]
      }
    },
    "chart": "Table",
    "accumulated": "true",
    "metric": "ActualCost",
    "kpis": [
      {
        "type": "Forecast",
        "id": null,
        "enabled": true
      },
      {
        "type": "Budget",
        "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo",
        "enabled": true
      }
    ],
    "pivots": [
      {
        "type": "Dimension",
        "name": "ServiceName"
      },
      {
        "type": "Dimension",
        "name": "MeterCategory"
      },
      {
        "type": "TagKey",
        "name": "swaggerTagKey"
      }
    ]
  }
}
{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample",
  "name": "swaggerExample",
  "type": "Microsoft.CostManagement/Views",
  "eTag": "\"1d4ffa5a9c2430c\"",
  "properties": {
    "displayName": "swagger Example",
    "scope": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG",
    "query": {
      "type": "Usage",
      "timeframe": "MonthToDate",
      "dataSet": {
        "granularity": "Daily",
        "aggregation": {
          "totalCost": {
            "name": "PreTaxCost",
            "function": "Sum"
          }
        },
        "grouping": [],
        "sorting": [
          {
            "direction": "Ascending",
            "name": "UsageDate"
          }
        ]
      }
    },
    "chart": "Table",
    "accumulated": "true",
    "metric": "ActualCost",
    "kpis": [
      {
        "type": "Forecast",
        "id": null,
        "enabled": true
      },
      {
        "type": "Budget",
        "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo",
        "enabled": true
      }
    ],
    "pivots": [
      {
        "type": "Dimension",
        "name": "ServiceName"
      },
      {
        "type": "Dimension",
        "name": "MeterCategory"
      },
      {
        "type": "TagKey",
        "name": "swaggerTagKey"
      }
    ]
  }
}

定義

名前 説明
AccumulatedType

時間の経過に伴う累積コストを表示します。

ChartType

コスト分析のメイン ビューのグラフの種類。 必須。

ErrorDetails

エラーの詳細。

ErrorResponse

エラー応答は、サービスが受信要求を処理できないことを示します。 理由は、エラー メッセージに示されています。

いくつかのエラー応答:

  • 429 TooManyRequests - 要求が調整されました。 "x-ms-ratelimit-microsoft.consumption-retry-after" ヘッダーで指定された時間を待ってから再試行します。

  • 503 ServiceUnavailable - サービスは一時的に使用できません。 "Retry-After" ヘッダーで指定された時刻まで待ってから、再試行してください。

FunctionType

使用する集計関数の名前。

KpiProperties

各 KPI には、'type' キーと 'enabled' キーが含まれている必要があります。

KpiTypeType

KPI の種類 (予測、予算)。

MetricType

コストを表示するときに使用するメトリック。

OperatorType

比較に使用する演算子。

PivotProperties

各ピボットには、'type' と 'name' が含まれている必要があります。

PivotTypeType

ビューに表示するデータ型。

QueryColumnType

エクスポートの列の型。

ReportConfigAggregation

レポートで使用する集計式。

ReportConfigComparisonExpression

レポートで使用する比較式。

ReportConfigDataset

レポートに存在するデータの定義。

ReportConfigDatasetConfiguration

レポート内のデータセットの構成。

ReportConfigFilter

レポートで使用するフィルター式。

ReportConfigGrouping

レポートで使用する式によるグループ化。

ReportConfigSorting

レポートで使用される式による順序。

ReportConfigSortingType

並べ替えの方向。

ReportConfigTimePeriod

レポートのデータを取得するための開始日と終了日。

ReportGranularityType

レポート内の行の粒度。

ReportTimeframeType

レポートのデータをプルするための時間枠。 カスタムの場合は、特定の期間を指定する必要があります。

ReportType

レポートの種類。 使用状況は実際の使用状況を表し、予測は予測データを表し、UsageAndForecast は使用状況と予測データの両方を表します。 実際の使用状況と予測データは、日付に基づいて区別できます。

View

コスト分析の状態と構成。

AccumulatedType

時間の経過に伴う累積コストを表示します。

名前 説明
false

string

true

string

ChartType

コスト分析のメイン ビューのグラフの種類。 必須。

名前 説明
Area

string

GroupedColumn

string

Line

string

StackedColumn

string

Table

string

ErrorDetails

エラーの詳細。

名前 説明
code

string

エラー コード。

message

string

操作が失敗した理由を示すエラー メッセージ。

ErrorResponse

エラー応答は、サービスが受信要求を処理できないことを示します。 理由は、エラー メッセージに示されています。

いくつかのエラー応答:

  • 429 TooManyRequests - 要求が調整されました。 "x-ms-ratelimit-microsoft.consumption-retry-after" ヘッダーで指定された時間を待ってから再試行します。

  • 503 ServiceUnavailable - サービスは一時的に使用できません。 "Retry-After" ヘッダーで指定された時刻まで待ってから、再試行してください。

名前 説明
error

ErrorDetails

エラーの詳細。

FunctionType

使用する集計関数の名前。

名前 説明
Sum

string

KpiProperties

各 KPI には、'type' キーと 'enabled' キーが含まれている必要があります。

名前 説明
enabled

boolean

UI に KPI を表示しますか?

id

string

メトリック (予算) に関連するリソースの ID。

type

KpiTypeType

KPI の種類 (予測、予算)。

KpiTypeType

KPI の種類 (予測、予算)。

名前 説明
Budget

string

Forecast

string

MetricType

コストを表示するときに使用するメトリック。

名前 説明
AHUB

string

ActualCost

string

AmortizedCost

string

OperatorType

比較に使用する演算子。

名前 説明
Contains

string

In

string

PivotProperties

各ピボットには、'type' と 'name' が含まれている必要があります。

名前 説明
name

string

ビューに表示するデータ フィールド。

type

PivotTypeType

ビューに表示するデータ型。

PivotTypeType

ビューに表示するデータ型。

名前 説明
Dimension

string

TagKey

string

QueryColumnType

エクスポートの列の型。

名前 説明
Dimension

string

コスト データのディメンション。

TagKey

string

コスト データに関連付けられているタグ。

ReportConfigAggregation

レポートで使用する集計式。

名前 説明
function

FunctionType

使用する集計関数の名前。

name

string

集計する列の名前。

ReportConfigComparisonExpression

レポートで使用する比較式。

名前 説明
name

string

比較に使用する列の名前。

operator

OperatorType

比較に使用する演算子。

values

string[]

比較に使用する値の配列

ReportConfigDataset

レポートに存在するデータの定義。

名前 説明
aggregation

<string,  ReportConfigAggregation>

レポートで使用する集計式のディクショナリ。 ディクショナリ内の各項目のキーは、集計列の別名です。 レポートには、最大 2 つの集計句を含めることができます。

configuration

ReportConfigDatasetConfiguration

レポート内のデータの構成情報があります。 集計とグループ化が指定されている場合、構成は無視されます。

filter

ReportConfigFilter

レポートで使用するフィルター式があります。

granularity

ReportGranularityType

レポート内の行の粒度。

grouping

ReportConfigGrouping[]

レポートで使用する式によるグループ化の配列。 レポートには、句ごとに最大 2 つのグループを含めることができます。

sorting

ReportConfigSorting[]

レポートで使用する式別の順序の配列。

ReportConfigDatasetConfiguration

レポート内のデータセットの構成。

名前 説明
columns

string[]

レポートに含める列名の配列。 任意の有効なレポート列名を使用できます。 指定しない場合、レポートにはすべての列が含まれます。

ReportConfigFilter

レポートで使用するフィルター式。

名前 説明
and

ReportConfigFilter[]

論理 "AND" 式。 少なくとも 2 つの項目が必要です。

dimensions

ReportConfigComparisonExpression

ディメンションの比較式がある

or

ReportConfigFilter[]

論理 "OR" 式。 少なくとも 2 つの項目が必要です。

tags

ReportConfigComparisonExpression

タグの比較式がある

ReportConfigGrouping

レポートで使用する式によるグループ化。

名前 説明
name

string

グループ化する列の名前。 このバージョンでは、可能な限り最も低い粒度のサブスクリプションがサポートされています。

type

QueryColumnType

グループ化する列の型を持っています。

ReportConfigSorting

レポートで使用される式による順序。

名前 説明
direction

ReportConfigSortingType

並べ替えの方向。

name

string

並べ替える列の名前。

ReportConfigSortingType

並べ替えの方向。

名前 説明
Ascending

string

Descending

string

ReportConfigTimePeriod

レポートのデータを取得するための開始日と終了日。

名前 説明
from

string

データをプルする開始日。

to

string

データをプルする終了日。

ReportGranularityType

レポート内の行の粒度。

名前 説明
Daily

string

Monthly

string

ReportTimeframeType

レポートのデータをプルするための時間枠。 カスタムの場合は、特定の期間を指定する必要があります。

名前 説明
Custom

string

MonthToDate

string

WeekToDate

string

YearToDate

string

ReportType

レポートの種類。 使用状況は実際の使用状況を表し、予測は予測データを表し、UsageAndForecast は使用状況と予測データの両方を表します。 実際の使用状況と予測データは、日付に基づいて区別できます。

名前 説明
Usage

string

View

コスト分析の状態と構成。

名前 説明
eTag

string

リソースの eTag。 同時更新シナリオを処理するために、このフィールドを使用して、ユーザーが最新バージョンを更新しているかどうかを判断します。

id

string

リソース ID。

name

string

リソース名。

properties.accumulated

AccumulatedType

時間の経過に伴う累積コストを表示します。

properties.chart

ChartType

コスト分析のメイン ビューのグラフの種類。 必須。

properties.createdOn

string

ユーザーがこのビューを作成した日付。

properties.currency

string

現在のビューの通貨。

properties.dateRange

string

現在のビューの日付範囲。

properties.displayName

string

ビューのユーザー入力名。 必須。

properties.kpis

KpiProperties[]

コスト分析 UI に表示する KPI の一覧。

properties.metric

MetricType

コストを表示するときに使用するメトリック。

properties.modifiedOn

string

ユーザーがこのビューを最後に変更した日付。

properties.pivots

PivotProperties[]

Cost Analysis UI での 3 つのサブビューの構成。

properties.query.dataSet

ReportConfigDataset

このレポート構成にデータの定義があります。

properties.query.includeMonetaryCommitment

boolean

true の場合、レポートには年額コミットメントが含まれます。

properties.query.timePeriod

ReportConfigTimePeriod

レポートのデータをプルするための期間があります。

properties.query.timeframe

ReportTimeframeType

レポートのデータをプルするための時間枠。 カスタムの場合は、特定の期間を指定する必要があります。

properties.query.type

ReportType

レポートの種類。 使用状況は実際の使用状況を表し、予測は予測データを表し、UsageAndForecast は使用状況と予測データの両方を表します。 実際の使用状況と予測データは、日付に基づいて区別できます。

properties.scope

string

ビューを保存する Cost Management スコープ。 これには、サブスクリプション スコープの 'subscriptions/{subscriptionId}' が含まれます。 resourceGroup スコープの場合は 'subscriptions/{subscriptionId}/{resourceGroupName}'、課金アカウント スコープの場合は 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}'、Department スコープの場合は 'providers/Microsoft.Billing/billingAccountId}/{billingAccountId}/{billingAccountId}'、部門スコープの場合は 'providers/Microsoft.Billing/billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{ExternalBillingAccount スコープの場合は externalBillingAccountName}'、ExternalSubscription スコープの場合は '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' です。

type

string

リソースの種類。