次の方法で共有


コンピューティングの FinOps のベスト プラクティス

この記事では、コンピューティング サービスの実績のある FinOps プラクティスのコレクションについて説明します。 コストの最適化、効率の向上、Azure のコンピューティング リソースに関する分析情報の取得に関するガイダンスが提供されます。 このプラクティスは、仮想マシン (VM)、Azure Kubernetes Service (AKS)、Azure Functions などのコンピューティング サービスの種類に基づいて分類されます。


Azure Kubernetes Service

次のセクションでは、AKS クラスターの Azure Resource Graph (ARG) クエリについて説明します。 このクエリは、VM に関する分析情報を得るのに役立ちます。

クエリ - AKS クラスター

この ARG クエリは、Azure 環境内の AKS クラスターに関する詳細情報を取得します。

カテゴリ

リソース管理

クエリ

resources
| where type == "microsoft.containerservice/managedclusters"
| extend AgentPoolProfiles = properties.agentPoolProfiles
| mvexpand AgentPoolProfiles
| project
    id,
    ProfileName = tostring(AgentPoolProfiles.name),
    Sku = tostring(sku.name),
    Tier = tostring(sku.tier),
    mode = AgentPoolProfiles.mode,
    AutoScaleEnabled = AgentPoolProfiles.enableAutoScaling,
    SpotVM = AgentPoolProfiles.scaleSetPriority,
    VMSize = tostring(AgentPoolProfiles.vmSize),
    nodeCount = tostring(AgentPoolProfiles.['count']),
    minCount = tostring(AgentPoolProfiles.minCount),
    maxCount = tostring(AgentPoolProfiles.maxCount),
    location,
    resourceGroup,
    subscriptionId,
    AKSname = name

仮想マシン

Azure 仮想マシン (VM) は、Azure が 提供する、オンデマンドでスケーラブルなコンピューティング リソースのいくつかの種類の 1 つです。 通常、コンピューティング環境を他の選択肢よりも詳細に制御する必要がある場合は、VM を選択します。

Azure VM を使用すると、それを実行する物理ハードウェアを購入して保守する必要なく、仮想化の柔軟性を実現できます。 ただし、VM の構成、修正プログラムの適用、実行するソフトウェアのインストールなどのタスクを実行して、VM を維持する必要があります。

関連情報を次に示します。

仮想マシンの割り当てを解除する

推奨事項: 未使用のコンピューティング料金を回避するために VM の割り当てを解除します。 VM の割り当てを解除せずに停止しないようにします。

実行されていない VM について

VM には、停止状態と割り当て解除状態の 2 つの非実行状態があります。

停止した VM は、オペレーティング システム内からシャットダウンされています (たとえば、shutdown コマンドを使用)。 停止した VM の電源はオフになっていますが、Azure は引き続き CPU やメモリなどのコンピューティング リソースを予約します。 コンピューティング リソースは予約されており、他の VM では使用できないため、これらの VM では引き続きコンピューティング料金が発生します。

割り当て解除された VM は、Azure portal、CLI、PowerShell、またはその他のクライアント ツールのクラウド管理 API を介して停止されます。 VM の割り当てが解除されると、Azure は対応するコンピューティング リソースを解放します。 コンピューティング リソースは解放されるため、これらの VM ではコンピューティング料金は発生しません。ただし、停止された VM と割り当て解除された VM の両方で、ディスクからのストレージ料金など、コンピューティング以外の料金が発生する点に注意することが重要です。

停止した VM を特定する

次の Azure Resource Graph (ARG) クエリを使用して、割り当てが解除されていない停止した VM を特定します。 電源状態、場所、リソース グループ、サブスクリプション ID に関する詳細を取得します。

resources
| where type =~ 'microsoft.compute/virtualmachines'
| extend PowerState = tostring(properties.extended.instanceView.powerState.displayStatus)
| where PowerState !in =('VM deallocated', 'VM running')
| project
    ResourceId = id,
    PowerState,
    Region = location,
    ResourceGroupName = resourceGroup,
    SubscriptionId = subscriptionId

コミットメント割引を活用する

推奨事項: コミットメント割引を活用して、リスト コストと比較して最大 72% を節約します。

コミットメント割引について

コミットメント割引は、指定された期間または期間 (通常は 1 年または 3 年) に Azure サービスの使用をコミットする組織に提供される財務インセンティブです。 期間の一定の使用量または支出 (コスト) に同意することで、組織は定価と比較して大幅な割引 (最大 72%) の恩恵を受けることができます。 割引は対象となるリソースに適用され、組織はクラウド コストを節約しながら、予算作成の柔軟性と予測可能性を提供するのに役立ちます。

コミットメント割引の詳細については、レート最適化機能を参照してください。

仮想マシン コミットメントの割引範囲を測定する

次の FinOps ハブ クエリを使用して、VM コミットメントの割引範囲全体を測定します。

Costs
| where ResourceType =~ 'Virtual machine'
| where x_SkuMeterCategory startswith 'Virtual Machines'
//
// Join with prices to filter out ineligible SKUs
| extend tmp_MeterKey = strcat(substring(ChargePeriodStart, 0, 7), x_SkuMeterId)
| project tmp_MeterKey, EffectiveCost, PricingCategory, CommitmentDiscountCategory, ResourceName, x_ResourceGroupName, SubAccountName, BillingCurrency
| join kind=leftouter (
    Prices
    | where x_SkuMeterCategory startswith 'Virtual Machines'
    | summarize sp = countif(x_SkuPriceType == 'SavingsPlan'), ri = countif(x_SkuPriceType == 'ReservedInstance')
        by tmp_MeterKey = strcat(substring(x_EffectivePeriodStart, 0, 7), x_SkuMeterId)
    | project tmp_MeterKey, x_CommitmentDiscountSpendEligibility = iff(sp == 0, 'Not Eligible', 'Eligible'), x_CommitmentDiscountUsageEligibility = iff(ri == 0, 'Not Eligible', 'Eligible')
) on tmp_MeterKey
| extend x_CommitmentDiscountUsageEligibility = iff(isempty(x_CommitmentDiscountUsageEligibility), '(missing prices)', x_CommitmentDiscountUsageEligibility)
| extend x_CommitmentDiscountSpendEligibility = iff(isempty(x_CommitmentDiscountSpendEligibility), '(missing prices)', x_CommitmentDiscountSpendEligibility)
//
// Sum costs
| summarize
    TotalCost = sum(EffectiveCost),
    OnDemandCost = sumif(EffectiveCost, PricingCategory == 'Standard'),
    SpotCost = sumif(EffectiveCost, PricingCategory == 'Dynamic'),
    CommittedCost = sumif(EffectiveCost, PricingCategory == 'Committed'),
    CommittedSpendCost = sumif(EffectiveCost, CommitmentDiscountCategory == 'Spend'),
    CommittedUsageCost = sumif(EffectiveCost, CommitmentDiscountCategory == 'Usage')
    by x_CommitmentDiscountUsageEligibility, x_CommitmentDiscountSpendEligibility, BillingCurrency
| extend OnDemandPercent = round(OnDemandCost / TotalCost * 100, 2)
| extend CoveragePercent = round(CommittedCost / TotalCost * 100, 2)
| extend CoverageUsagePercent = round(CommittedUsageCost / TotalCost * 100, 2)
| extend CoverageSpendPercent = round(CommittedSpendCost / TotalCost * 100, 2)
| order by CoveragePercent desc

次のクエリを使用して、VM あたりのカバレッジを測定します。

Costs
| where ResourceType =~ 'Virtual machine'
| where x_SkuMeterCategory startswith 'Virtual Machines'
//
// Join with prices to filter out ineligible SKUs
| extend tmp_MeterKey = strcat(substring(ChargePeriodStart, 0, 7), x_SkuMeterId)
| project tmp_MeterKey, EffectiveCost, PricingCategory, CommitmentDiscountCategory, ResourceName, x_ResourceGroupName, SubAccountName, BillingCurrency
| join kind=leftouter (
    Prices
    | where x_SkuMeterCategory startswith 'Virtual Machines'
    | summarize sp = countif(x_SkuPriceType == 'SavingsPlan'), ri = countif(x_SkuPriceType == 'ReservedInstance')
        by tmp_MeterKey = strcat(substring(x_EffectivePeriodStart, 0, 7), x_SkuMeterId)
    | project tmp_MeterKey, x_CommitmentDiscountSpendEligibility = iff(sp == 0, 'Not Eligible', 'Eligible'), x_CommitmentDiscountUsageEligibility = iff(ri == 0, 'Not Eligible', 'Eligible')
) on tmp_MeterKey
| extend x_CommitmentDiscountUsageEligibility = iff(isempty(x_CommitmentDiscountUsageEligibility), '(missing prices)', x_CommitmentDiscountUsageEligibility)
| extend x_CommitmentDiscountSpendEligibility = iff(isempty(x_CommitmentDiscountSpendEligibility), '(missing prices)', x_CommitmentDiscountSpendEligibility)
//
// Sum costs by resource
| summarize
    TotalCost = sum(EffectiveCost),
    OnDemandCost = sumif(EffectiveCost, PricingCategory == 'Standard'),
    SpotCost = sumif(EffectiveCost, PricingCategory == 'Dynamic'),
    CommittedCost = sumif(EffectiveCost, PricingCategory == 'Committed'),
    CommittedSpendCost = sumif(EffectiveCost, CommitmentDiscountCategory == 'Spend'),
    CommittedUsageCost = sumif(EffectiveCost, CommitmentDiscountCategory == 'Usage')
    by ResourceName, x_ResourceGroupName, SubAccountName, x_CommitmentDiscountUsageEligibility, x_CommitmentDiscountSpendEligibility, BillingCurrency
| extend OnDemandPercent = round(OnDemandCost / TotalCost * 100, 2)
| extend CoveragePercent = round(CommittedCost / TotalCost * 100, 2)
| extend CoverageUsagePercent = round(CommittedUsageCost / TotalCost * 100, 2)
| extend CoverageSpendPercent = round(CommittedSpendCost / TotalCost * 100, 2)
| order by CoveragePercent desc

FinOps ハブの詳細については、FinOps ハブのを参照してください。

クエリ - 仮想マシン スケール セットの詳細

このクエリでは、SKU、スポット VM の優先度、および優先度ミックス ポリシーに基づいて、Azure 環境内の仮想マシン スケール セットを分析します。 コストの最適化とリソース管理戦略に関する分析情報が提供されます。

カテゴリ

リソース管理

クエリ

resources
| where type =~ 'microsoft.compute/virtualmachinescalesets'
| extend SpotVMs = tostring(properties.virtualMachineProfile.priority)
| extend SpotPriorityMix = tostring(properties.priorityMixPolicy)
| extend SKU = tostring(sku.name)
| extend resourceGroup = strcat('/subscriptions/', subscriptionId, '/resourceGroups/', resourceGroup)
| project id, SKU, SpotVMs, SpotPriorityMix, subscriptionId, resourceGroup, location

クエリ - 仮想マシン プロセッサの種類の分析

このクエリでは、Azure 環境内の VM によって使用されるプロセッサの種類 (ARM、AMD、または Intel) が識別されます。 これは、さまざまなプロセッサ アーキテクチャ間での VM の分散を理解するのに役立ちます。これは、ワークロードのパフォーマンスとコスト効率を最適化するのに役立ちます。

カテゴリ

リソース管理

クエリ

resources
| where type == 'microsoft.compute/virtualmachines'
| extend vmSize = properties.hardwareProfile.vmSize
| extend processorType = case(
    // ARM Processors
    vmSize has "Epsv5"
        or vmSize has "Epdsv5"
        or vmSize has "Dpsv5"
        or vmSize has "Dpdsv", "ARM",
    // AMD Processors
    vmSize has "Standard_D2a"
        or vmSize has "Standard_D4a"
        or vmSize has "Standard_D8a"
        or vmSize has "Standard_D16a"
        or vmSize has "Standard_D32a"
        or vmSize has "Standard_D48a"
        or vmSize has "Standard_D64a"
        or vmSize has "Standard_D96a"
        or vmSize has "Standard_D2as"
        or vmSize has "Standard_D4as"
        or vmSize has "Standard_D8as"
        or vmSize has "Standard_D16as"
        or vmSize has "Standard_D32as"
        or vmSize has "Standard_D48as"
        or vmSize has "Standard_D64as"
        or vmSize has "Standard_D96as", "AMD",
    "Intel"
)
| project vmName = name, processorType, vmSize, resourceGroup

その他をお探しですか?

何か見逃したの? 何か追加された内容を確認しますか? ここで取り上げたい質問、問題、または解決策についてお聞きください。 ここに含める詳細を含む新しい問題を作成 します。


関連情報を次に示します。

関連製品:

関連するソリューション: