Virtual Machines
The presented resiliency recommendations in this guidance include Virtual Machines and dependent resources and settings.
Summary of Recommendations
Recommendations Details
VM-1 - VMSS Flex を使用して 2 つ以上の VM で運用ワークロードを実行します
Category: Availability
Impact: High
Guidance
本番環境の VM ワークロードは、複数の VM にデプロイし、VMSS Flex インスタンスにグループ化する必要があります。VMSS Flex は、プラットフォーム全体に VM をインテリジェントに分散し、プラットフォームの障害やプラットフォームの更新がワークロードに与える影響を最小限に抑えます。単一インスタンス VM で実行されているワークロードは、それらのインスタンスが複数の可用性ゾーンに分散している場合でも、VM が相互に関連していることをプラットフォームが認識する方法がないため、同じ保護を受けることはできません。
Resources
- What has changed with Flexible orchestration mode
- Attach or detach a Virtual Machine to or from a Virtual Machine Scale Set
Resource Graph Query
// Azure Resource Graph Query
// Find all VMs that are not associated with a VMSS Flex instance
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| where isnull(properties.virtualMachineScaleSet.id)
| project recommendationId="vm-1", name, id, tags
VM-2 - 可用性ゾーン間で VM をデプロイします
Category: Availability
Impact: High
Guidance
Azure Availability Zones は、各 Azure リージョン内の物理的に分離された場所であり、ローカルの障害に耐えられます。可用性ゾーンを使用して、データセンターの予期せぬ障害からアプリケーションとデータを保護します。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VMs that are not assigned to a Zone
Resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| where isnull(zones)
| project recommendationId="vm-2", name, id, tags, param1="No Zone"
VM-3 - 可用性セットを使用した VM を VMSS Flex に移行します
Category: Availability
Impact: High
Guidance
可用性セットは近い将来廃止される予定です。ワークロードを VM から VMSS Flex に移行することで、ワークロードを最新化します。VMSS Flex では、次の 2 つの方法のいずれかで VM をデプロイできます。
.ゾーン間 .同じゾーン内ですが、フォルト・ドメイン(FD)と更新ドメイン(UD)を自動的にまたがります。
N 層アプリケーションでは、各アプリケーション層を独自の VMSS Flex に配置することをお勧めします。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VMs using Availability Sets
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| where isnotnull(properties.availabilitySet)
| project recommendationId = "vm-3", name, id, tags, param1=strcat("availabilitySet: ",properties.availabilitySet.id)
VM-4 - Azure Site Recovery を使用して VM をレプリケートします
Category: Disaster Recovery
Impact: Medium
Guidance
Site Recovery を使用して Azure VM をレプリケートすると、すべての VM ディスクがターゲット リージョンに非同期的に継続的にレプリケートされます。復旧ポイントは数分ごとに作成されます。これにより、分単位で目標復旧時点 (RPO) が得られます。ディザスター リカバリーの訓練は、運用アプリケーションや進行中のレプリケーションに影響を与えることなく、何度でも実行できます。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VMs that do NOT have replication with ASR enabled
// Run query to see results.
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| project name, id, tags
| join kind=leftouter (
recoveryservicesresources
| where type =~ 'Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems'
| where properties.providerSpecificDetails.dataSourceInfo.datasourceType =~ 'AzureVm'
| project id=properties.providerSpecificDetails.dataSourceInfo.resourceId
| extend name=strcat_array(array_slice(split(id, '/'), 8, -1), '/')
) on name
| where isnull(id1)
| project-away id1
| project-away name1
| project recommendationId = "vm-4", name, id, tags
| order by id asc
VM-5 - VM ディスクに Managed Disks を使用します
Category: Availability
Impact: High
Guidance
Azure アンマネージド ディスクは、2025 年 9 月 30 日に完全に廃止されます。アンマネージド ディスクを使用する場合は、今すぐ移行の計画を開始してください。
Resources
- Migrate your Azure unmanaged disks by Sep 30, 2025
- Migrate Windows VM from unmanaged disks to managed disks
- Migrate Linux VM from unmanaged disks to managed disks
Resource Graph Query
// Azure Resource Graph Query
// Find all VMs that are not using Managed Disks
Resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| where isnull(properties.storageProfile.osDisk.managedDisk)
| project recommendationId = "vm-5", name, id, tags
VM-6 - データベース データをデータ ディスクにホストします
Category: System Efficiency
Impact: Low
Guidance
データベース データを OS ディスクではなくデータ ディスクでホストします。 データ ディスクは、保持する必要があるデータを格納するために仮想マシンに接続されるマネージド ディスクです。データ ディスクは SCSI ドライブとして登録され、選択した文字でラベル付けされます。データ ディスクでデータをホストすると、データのバックアップや復元の柔軟性が高まり、仮想マシンとオペレーティング システム全体を移行することなくディスクを移行できます。要件を満たす、さまざまな種類、サイズ、パフォーマンスの別のディスク SKU を選択できます。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VMs that only have OS Disk
Resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| where array_length(properties.storageProfile.dataDisks) < 1
| project recommendationId = "vm-6", name, id, tags
VM-7 - Azure Backup サービスを使用して VM をバックアップします
Category: Disaster Recovery
Impact: Medium
Guidance
仮想マシンのバックアップを有効にして、データをセキュリティで保護し、迅速に復元します。Azure Backup サービスは、データをバックアップし、Microsoft Azure クラウドから復旧するための、シンプルで安全、かつコスト効率の高いソリューションを提供します。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VMs that do NOT have Backup enabled
// Run query to see results.
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| project name, id, tags
| join kind=leftouter (
recoveryservicesresources
| where type =~ 'Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems'
| where properties.dataSourceInfo.datasourceType =~ 'Microsoft.Compute/virtualMachines'
| project idBackupEnabled=properties.sourceResourceId
| extend name=strcat_array(array_slice(split(idBackupEnabled, '/'), 8, -1), '/')
) on name
| where isnull(idBackupEnabled)
| project-away idBackupEnabled
| project-away name1
| project recommendationId = "vm-7", name, id, tags
| order by id asc
VM-8 - 運用 VM では SSD ディスクを使用している必要があります
Category: System Efficiency
Impact: High
Guidance
Premium SSD ディスクは、I/O 集中型のアプリケーションや運用ワークロードに対して、高パフォーマンスで待機時間の短いディスク サポートを提供します。Standard SSD ディスクは、より低い IOPS レベルで一貫したパフォーマンスを必要とするワークロード向けに最適化された、コスト効率の高いストレージ オプションです。
次のことをお勧めします。
- Standard HDD ディスクは、開発/テストのシナリオと重要度の低いワークロードに最小のコストで使用します。
- Premium 対応 VM では、Standard HDD ディスクではなく Premium SSD ディスクを使用します。すべてのオペレーティング システム ディスクとデータ ディスクに Premium Storage を使用する単一インスタンス VM の場合、Azure は 99.9% 以上の VM 接続を保証します。
Standard HDD から Premium SSD ディスクにアップグレードする場合は、次の問題を考慮してください。
- アップグレードには VM の再起動が必要であり、このプロセスは完了するまでに 3 分から 5 分かかります。
- VM がミッション クリティカルな運用 VM の場合は、Premium ディスクのコストに対して可用性の向上を評価します。
This does not apply to ephemeral disks Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all disks with StandardHDD sku attached to VMs
Resources
| where type =~ 'Microsoft.Compute/disks'
| where sku.name == 'Standard_LRS' and sku.tier == 'Standard'
| where managedBy != ""
| project recommendationId = "vm-8", name, id, tags, param1=strcat("managedBy: ", managedBy)
VM-9 - 停止状態の VM を確認します
Category: Governance
Impact: Low
Guidance
Azure Virtual Machines (VM) インスタンスは、さまざまな状態を経ます。プロビジョニング状態と電源状態があります。仮想マシンが実行されていない場合は、仮想マシンに問題が発生している可能性があるか、不要になり、削除してコストを削減する可能性があることを示します。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VMs that are NOT running
Resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| where properties.extended.instanceView.powerState.displayStatus != 'VM running'
| project recommendationId = "vm-9", name, id, tags
VM-10 - 高速ネットワーク(AccelNet)を有効にします
Category: System Efficiency
Impact: Medium
Guidance
高速ネットワークにより、VM へのシングル ルート I/O 仮想化 (SR-IOV) が可能になり、ネットワーク パフォーマンスが大幅に向上します。この高パフォーマンス パスは、データ パスからホストをバイパスし、サポートされている VM の種類で最も要求の厳しいネットワーク ワークロードの待機時間、ジッター、CPU 使用率を削減します。
この構成は必ずしも必要ではないため、ワークロードの要件に応じてこのオプションを評価してください。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VM NICs that do not have Accelerated Networking enabled
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| mv-expand nic = properties.networkProfile.networkInterfaces
| project name, id, tags, lowerCaseNicId = tolower(nic.id), vmSize = tostring(properties.hardwareProfile.vmSize)
| join kind = inner (
resources
| where type =~ 'Microsoft.Network/networkInterfaces'
| where properties.enableAcceleratedNetworking == false
| project nicName = split(id, "/")[8], lowerCaseNicId = tolower(id)
)
on lowerCaseNicId
| summarize nicNames = make_set(nicName) by name, id, tostring(tags), vmSize
| extend param1 = strcat("NicName: ", strcat_array(nicNames, ", ")), param2 = strcat("VMSize: ", vmSize)
| project recommendationId = "vm-10", name, id, tags, param1, param2
| order by id asc
VM-11 - AccelNet が有効になっている場合は、GuestOS NIC ドライバを手動で更新する必要があります
Category: Governance
Impact: Low
Guidance
高速ネットワークを有効にすると、GuestOS の既定の Azure Virtual Network インターフェイスが Mellanox に置き換えられ、そのドライバーはサードパーティ ベンダーから提供されます。Microsoft が管理する Marketplace イメージは、最新バージョンの Mellanox ドライバーで提供されますが、仮想マシンがデプロイされた後は、ドライバーを最新の状態に維持する責任があります。
Resources
Resource Graph Query
// cannot-be-validated-with-arg
VM-12 - VM にはパブリック IP を直接関連付けないでください
Category: Access & Security
Impact: Medium
Guidance
仮想マシンで送信インターネット接続が必要な場合は、NAT Gateway または Azure Firewall を使用することをお勧めします。どちらのサービスも可用性と SNAT ポートがはるかに高いため、サービスのセキュリティと回復性を高めるのに役立ちます。受信インターネット接続には、Azure Load Balancer や Application Gateway などの負荷分散ソリューションを使用することをお勧めします。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VMs with PublicIPs directly associated with them
Resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| where isnotnull(properties.networkProfile.networkInterfaces)
| mv-expand nic=properties.networkProfile.networkInterfaces
| project name, id, tags, nicId = nic.id
| extend nicId = tostring(nicId)
| join kind=inner (
Resources
| where type =~ 'Microsoft.Network/networkInterfaces'
| where isnotnull(properties.ipConfigurations)
| mv-expand ipconfig=properties.ipConfigurations
| extend publicIp = tostring(ipconfig.properties.publicIPAddress.id)
| where publicIp != ""
| project name, nicId = tostring(id), publicIp
) on nicId
| project recommendationId = "vm-12", name, id, tags
| order by id asc
VM-13 - VM ネットワーク インターフェイスと関連付けられているサブネットの両方に、ネットワーク セキュリティ グループ (NSG) が関連付けられています
Category: Access & Security
Impact: Low
Guidance
特別な理由がない限り、ネットワーク セキュリティ グループをサブネットまたはネットワーク インターフェイスに関連付けることをお勧めしますが、両方には関連付けないでください。サブネットに関連付けられたネットワーク・セキュリティ・グループのルールは、ネットワーク・インタフェースに関連付けられたネットワーク・セキュリティ・グループのルールと競合する可能性があるため、予期しない通信の問題が発生し、トラブルシューティングが必要になる可能性があります。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Provides a list of virtual machines and associated NICs that do have an NSG associated to them and also an NSG associated to the subnet.
Resources
| where type =~ 'Microsoft.Network/networkInterfaces'
| where isnotnull(properties.networkSecurityGroup)
| mv-expand ipConfigurations = properties.ipConfigurations, nsg = properties.networkSecurityGroup
| project nicId = tostring(id), subnetId = tostring(ipConfigurations.properties.subnet.id), nsgName=split(nsg.id, '/')[8]
| parse kind=regex subnetId with '/virtualNetworks/' virtualNetwork '/subnets/' subnet
| join kind=inner (
Resources
| where type =~ 'Microsoft.Network/NetworkSecurityGroups' and isnotnull(properties.subnets)
| project name, resourceGroup, subnet=properties.subnets
| mv-expand subnet
| project subnetId=tostring(subnet.id)
) on subnetId
| project nicId
| join kind=leftouter (
Resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| where isnotnull(properties.networkProfile.networkInterfaces)
| mv-expand nic=properties.networkProfile.networkInterfaces
| project vmName = name, vmId = id, tags, nicId = nic.id, nicName=split(nic.id, '/')[8]
| extend nicId = tostring(nicId)
) on nicId
| project recommendationId = "vm-13", name=vmName, id = vmId, tags, param1 = strcat("nic-name=", nicName)
VM-14 - IP 転送は、ネットワーク仮想アプライアンスに対してのみ有効にする必要があります
Category: Access & Security
Impact: Medium
Guidance
IP 転送により、仮想マシンのネットワーク インターフェイスで次のことが可能になります。
ネットワーク インターフェイスに割り当てられている IP 構成のいずれかに割り当てられている IP アドレスの 1 つを宛先としないネットワーク トラフィックを受信します。
ネットワーク インターフェイスの IP 構成の 1 つに割り当てられた送信元 IP アドレスとは異なる送信元 IP アドレスを使用してネットワーク トラフィックを送信します。
この設定は、仮想マシンが転送する必要があるトラフィックを受信する仮想マシンに接続されているすべてのネットワーク インターフェイスに対して有効にする必要があります。仮想マシンは、複数のネットワーク インターフェイスが接続されているか、単一のネットワーク インターフェイスが接続されているかに関係なく、トラフィックを転送できます。IP 転送は Azure の設定ですが、仮想マシンでは、ファイアウォール、WAN 最適化、負荷分散アプリケーションなど、トラフィックを転送できるアプリケーションも実行する必要があります。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VM NICs that have IPForwarding enabled. This feature is usually only required for Network Virtual Appliances
Resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| where isnotnull(properties.networkProfile.networkInterfaces)
| mv-expand nic=properties.networkProfile.networkInterfaces
| project name, id, tags, nicId = nic.id
| extend nicId = tostring(nicId)
| join kind=inner (
Resources
| where type =~ 'Microsoft.Network/networkInterfaces'
| where properties.enableIPForwarding == true
| project nicId = tostring(id)
) on nicId
| project recommendationId = "vm-14", name, id, tags
| order by id asc
VM-15 - お客様の DNS サーバーは、仮想ネットワーク レベルで構成する必要があります
Category: Storage
Impact: Low
Guidance
仮想ネットワークで DNS サーバーを構成して、環境全体の不整合を回避します。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VM NICs that have DNS Server settings configured in any of the NICs
Resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| where isnotnull(properties.networkProfile.networkInterfaces)
| mv-expand nic=properties.networkProfile.networkInterfaces
| project name, id, tags, nicId = nic.id
| extend nicId = tostring(nicId)
| join kind=inner (
Resources
| where type =~ 'Microsoft.Network/networkInterfaces'
| project name, id, dnsServers = properties.dnsSettings.dnsServers
| extend hasDns = array_length(dnsServers) >= 1
| where hasDns != 0
| project name, nicId = tostring(id)
) on nicId
| project recommendationId = "vm-15", name, id, tags
| order by id asc
VM-16 - 共有ディスクは、クラスタ化されたサーバーでのみ有効にする必要があります
Category: Storage
Impact: Medium
Guidance
Azure 共有ディスクは、マネージド ディスクを複数の仮想マシン (VM) に同時に接続できる Azure マネージド ディスクの機能です。マネージド ディスクを複数の VM に接続すると、新しいクラスター化されたアプリケーションを Azure にデプロイしたり、既存のクラスター化されたアプリケーションを Azure に移行したりできますが、ディスクがクラスターの複数の仮想マシン メンバーに割り当てられる状況でのみ使用する必要があります。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all Disks configured to be Shared. This is not an indication of an issue, but if a disk with this configuration is assigned to two or more VMs without a proper disk control mechanism (like a WSFC) it can lead to data loss
resources
| where type =~ 'Microsoft.Compute/disks'
| where isnotnull(properties.maxShares)
| project id, name, tags, lowerCaseDiskId = tolower(id), diskState = tostring(properties.diskState)
| join kind = leftouter (
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| project osDiskVmName = name, lowerCaseOsDiskId = tolower(properties.storageProfile.osDisk.managedDisk.id)
| join kind = fullouter (
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| mv-expand dataDisks = properties.storageProfile.dataDisks
| project dataDiskVmName = name, lowerCaseDataDiskId = tolower(dataDisks.managedDisk.id)
)
on $left.lowerCaseOsDiskId == $right.lowerCaseDataDiskId
| project lowerCaseDiskId = coalesce(lowerCaseOsDiskId, lowerCaseDataDiskId), vmName = coalesce(osDiskVmName, dataDiskVmName)
)
on lowerCaseDiskId
| summarize vmNames = make_set(vmName) by name, id, tostring(tags), diskState
| extend param1 = strcat("DiskState: ", diskState), param2 = iif(isempty(vmNames[0]), "VMName: n/a", strcat("VMName: ", strcat_array(vmNames, ", ")))
| project recommendationId = "vm-16", name, id, tags, param1, param2
| order by id asc
VM-17 - VM ディスクへのネットワーク アクセスは、 パブリック アクセスを無効にし、プライベート アクセスを有効に設定する必要があります
Category: Access & Security
Impact: Low
Guidance
「パブリック アクセスを無効にしてプライベート アクセスを有効にする」に変更し、プライベート・エンドポイントを作成することをお勧めします。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all Disks with "Enable public access from all networks" enabled
resources
| where type =~ 'Microsoft.Compute/disks'
| where properties.publicNetworkAccess == "Enabled"
| project id, name, tags, lowerCaseDiskId = tolower(id)
| join kind = leftouter (
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| project osDiskVmName = name, lowerCaseOsDiskId = tolower(properties.storageProfile.osDisk.managedDisk.id)
| join kind = fullouter (
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| mv-expand dataDisks = properties.storageProfile.dataDisks
| project dataDiskVmName = name, lowerCaseDataDiskId = tolower(dataDisks.managedDisk.id)
)
on $left.lowerCaseOsDiskId == $right.lowerCaseDataDiskId
| project lowerCaseDiskId = coalesce(lowerCaseOsDiskId, lowerCaseDataDiskId), vmName = coalesce(osDiskVmName, dataDiskVmName)
)
on lowerCaseDiskId
| summarize vmNames = make_set(vmName) by name, id, tostring(tags)
| extend param1 = iif(isempty(vmNames[0]), "VMName: n/a", strcat("VMName: ", strcat_array(vmNames, ", ")))
| project recommendationId = "vm-17", name, id, tags, param1
| order by id asc
VM-18 - VM が Azure ポリシーに準拠していることを確認します
Category: Governance
Impact: Low
Guidance
実行するアプリケーションに対して仮想マシン (VM) をセキュリティで保護することが重要です。VM のセキュリティ保護には、VM への安全なアクセスとデータの安全なストレージをカバーする 1 つ以上の Azure サービスと機能を含めることができます。この記事では、VM とアプリケーションをセキュリティで保護するための情報を提供します。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VMs in "NonCompliant" state with Azure Policies
PolicyResources
| where type =~ "Microsoft.PolicyInsights/policyStates" and properties.resourceType =~ "Microsoft.Compute/virtualMachines" and properties.complianceState =~ "NonCompliant"
| project
policyAssignmentName = properties.policyAssignmentName,
policyDefinitionName = properties.policyDefinitionName,
lowerCasePolicyDefinitionIdOfPolicyState = tolower(properties.policyDefinitionId),
lowerCaseVmIdOfPolicyState = tolower(properties.resourceId)
| join kind = leftouter (
PolicyResources
| where type =~ "Microsoft.Authorization/policyDefinitions"
| project lowerCasePolicyDefinitionId = tolower(id), policyDefinitionDisplayName = properties.displayName
)
on $left.lowerCasePolicyDefinitionIdOfPolicyState == $right.lowerCasePolicyDefinitionId
| project policyAssignmentName, policyDefinitionName, policyDefinitionDisplayName, lowerCaseVmIdOfPolicyState
| join kind = leftouter (
Resources
| where type =~ "Microsoft.Compute/virtualMachines"
| project vmName = name, vmId = id, vmTags = tags, lowerCaseVmId = tolower(id)
)
on $left.lowerCaseVmIdOfPolicyState == $right.lowerCaseVmId
| extend
param1 = strcat("AssignmentName: ", policyAssignmentName),
param2 = strcat("DefinitionName: ", policyDefinitionDisplayName), // Align to Azure portal's term.
param3 = strcat("DefinitionID: ", policyDefinitionName) // Align to Azure portal's term.
| project recommendationId = "vm-18", name = vmName, id = vmId, tags = vmTags, param1, param2, param3
VM-19 - マネージド ディスクの高度な暗号化オプションを有効にします
Category: Access & Security
Impact: Medium
Guidance
Azure Disk Storage サーバー側の暗号化 (保存時の暗号化または Azure Storage 暗号化とも呼ばれます) は、ストレージ クラスターに保持されるときに、Azure マネージド ディスク (OS およびデータ ディスク) に格納されているデータを自動的に暗号化します。マネージド ディスクで使用できる高度な暗号化オプションには、Azure Disk Encryption (ADE)、ホストでの暗号化、機密ディスクの暗号化など、いくつかの種類があります。
- ADE は、Linux の DM-Crypt 機能または Windows の BitLocker 機能を使用して、VM 内の Azure 仮想マシン (VM) のディスクを暗号化します。
- ホストでの暗号化により、VM をホストしている VM ホストに格納されているデータが保存時に暗号化され、暗号化されたストレージ クラスターに流れるようになります。
- 機密ディスクの暗号化は、ディスク暗号化キーを仮想マシンの TPM にバインドし、保護されたディスク コンテンツに VM からのみアクセスできるようにします。
Resources
Resource Graph Query
// under-development
VM-20 - VM Insights を有効にします
Category: Monitoring
Impact: Low
Guidance
VM insights は、仮想マシンと仮想マシン スケール セットのパフォーマンスと正常性を監視します。実行中のプロセスと他のリソースへの依存関係を監視します。VM insights は、パフォーマンスのボトルネックとネットワークの問題を特定することで、重要なアプリケーションの予測可能なパフォーマンスと可用性を提供するのに役立ちます。また、問題が他の依存関係に関連しているかどうかを理解するのにも役立ちます。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Check for VMs without Azure Monitoring Agent extension installed, missing Data Collection Rule or Data Collection Rule without performance enabled.
Resources
| where type == 'microsoft.compute/virtualmachines'
| project idVm = tolower(id), name, tags
| join kind=leftouter (
InsightsResources
| where type =~ "Microsoft.Insights/dataCollectionRuleAssociations" and id has "Microsoft.Compute/virtualMachines"
| project idDcr = tolower(properties.dataCollectionRuleId), idVmDcr = tolower(substring(id, 0, indexof(id, "/providers/Microsoft.Insights/dataCollectionRuleAssociations/"))))
on $left.idVm == $right.idVmDcr
| join kind=leftouter (
Resources
| where type =~ "Microsoft.Insights/dataCollectionRules"
| extend
isPerformanceEnabled = iif(properties.dataSources.performanceCounters contains "Microsoft-InsightsMetrics" and properties.dataFlows contains "Microsoft-InsightsMetrics", true, false),
isMapEnabled = iif(properties.dataSources.extensions contains "Microsoft-ServiceMap" and properties.dataSources.extensions contains "DependencyAgent" and properties.dataFlows contains "Microsoft-ServiceMap", true, false)//,
| where isPerformanceEnabled or isMapEnabled
| project dcrName = name, isPerformanceEnabled, isMapEnabled, idDcr = tolower(id))
on $left.idDcr == $right.idDcr
| join kind=leftouter (
Resources
| where type == 'microsoft.compute/virtualmachines/extensions' and (name contains 'AzureMonitorWindowsAgent' or name contains 'AzureMonitorLinuxAgent')
| extend idVmExtension = tolower(substring(id, 0, indexof(id, '/extensions'))), extensionName = name)
on $left.idVm == $right.idVmExtension
| where isPerformanceEnabled != 1 or (extensionName != 'AzureMonitorWindowsAgent' and extensionName != 'AzureMonitorLinuxAgent')
| project recommendationId = "vm-20", name, id = idVm, tags, param1 = strcat('MonitoringExtension:', extensionName), param2 = strcat('DataCollectionRuleId:', idDcr), param3 = strcat('isPerformanceEnabled:', isPerformanceEnabled)
VM-21 - すべての Azure Virtual Machines の診断設定を構成します
Category: Monitoring
Impact: Low
Guidance
プラットフォーム メトリックは、既定で構成なしで Azure Monitor メトリックに自動的に送信されます。 プラットフォーム ログは、Azure リソースとそれらが依存する Azure プラットフォームに関する詳細な診断および監査情報を提供します。
- リソース ログは、宛先にルーティングされるまで収集されません。
- アクティビティ ログは単独で存在しますが、他の場所にルーティングできます。
各 Azure リソースには、次の条件を定義する独自の診断設定が必要です。
- ソース:設定で定義された宛先に送信するメトリックおよびログデータのタイプ。使用可能なタイプは、リソースタイプによって異なります。
- 宛先: 送信先の 1 つ以上の宛先。
1 つの診断設定では、各宛先を 1 つしか定義できません。特定の宛先の種類の複数 (たとえば、2 つの異なる Log Analytics ワークスペース) にデータを送信する場合は、複数の設定を作成します。各リソースには、最大 5 つの診断設定を含めることができます。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all Virtual Machines without diagnostic settings enabled/with diagnostic settings enabled but not configured both performance counters and event logs/syslogs.
resources
| where type =~ "microsoft.compute/virtualmachines"
| project name, id, tags, lowerCaseVmId = tolower(id)
| join kind = leftouter (
resources
| where type =~ "Microsoft.Compute/virtualMachines/extensions" and properties.publisher =~ "Microsoft.Azure.Diagnostics"
| project
lowerCaseVmIdOfExtension = tolower(substring(id, 0, indexof(id, "/extensions/"))),
extensionType = properties.type,
provisioningState = properties.provisioningState,
storageAccount = properties.settings.StorageAccount,
// Windows
wadPerfCounters = properties.settings.WadCfg.DiagnosticMonitorConfiguration.PerformanceCounters.PerformanceCounterConfiguration,
wadEventLogs = properties.settings.WadCfg.DiagnosticMonitorConfiguration.WindowsEventLog,
// Linux
ladPerfCounters = properties.settings.ladCfg.diagnosticMonitorConfiguration.performanceCounters.performanceCounterConfiguration,
ladSyslog = properties.settings.ladCfg.diagnosticMonitorConfiguration.syslogEvents
| extend
// Windows
isWadPerfCountersConfigured = iif(array_length(wadPerfCounters) > 0, true, false),
isWadEventLogsConfigured = iif(isnotnull(wadEventLogs) and array_length(wadEventLogs.DataSource) > 0, true, false),
// Linux
isLadPerfCountersConfigured = iif(array_length(ladPerfCounters) > 0, true, false),
isLadSyslogConfigured = isnotnull(ladSyslog)
| project
lowerCaseVmIdOfExtension,
extensionType,
provisioningState,
storageAccount,
isPerfCountersConfigured = case(extensionType =~ "IaaSDiagnostics", isWadPerfCountersConfigured, extensionType =~ "LinuxDiagnostic", isLadPerfCountersConfigured, false),
isEventLogsConfigured = case(extensionType =~ "IaaSDiagnostics", isWadEventLogsConfigured, extensionType =~ "LinuxDiagnostic", isLadSyslogConfigured, false)
)
on $left.lowerCaseVmId == $right.lowerCaseVmIdOfExtension
| where isempty(lowerCaseVmIdOfExtension) or provisioningState !~ "Succeeded" or not(isPerfCountersConfigured and isEventLogsConfigured)
| extend
param1 = strcat("DiagnosticSetting: ", iif(isnotnull(extensionType), strcat("Enabled, partially configured (", extensionType, ")"), "Not enabled")),
param2 = strcat("ProvisioningState: ", iif(isnotnull(provisioningState), provisioningState, "n/a")),
param3 = strcat("storageAccount: ", iif(isnotnull(storageAccount), storageAccount, "n/a")),
param4 = strcat("PerformanceCounters: ", case(isnull(isPerfCountersConfigured), "n/a", isPerfCountersConfigured, "Configured", "Not configured")),
param5 = strcat("EventLogs/Syslogs: ", case(isnull(isEventLogsConfigured), "n/a", isEventLogsConfigured, "Configured", "Not configured"))
| project recommendationId = "vm-21", name, id, tags, param1, param2, param3, param4, param5
VM-22 - VM のメンテナンス構成を使用します
Category: Governance
Impact: High
Guidance
メンテナンス構成設定を使用すると、ユーザーは更新をスケジュールおよび管理し、VM の更新/中断が計画された時間枠内に確実に行われるようにすることができます。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find VMS that do not have maintenance configuration assigned
Resources
| extend resourceId = tolower(id)
| project name, location, type, id, tags, resourceId, properties
| where type =~ 'Microsoft.Compute/virtualMachines'
| join kind=leftouter (
maintenanceresources
| where type =~ "microsoft.maintenance/configurationassignments"
| project planName = name, type, maintenanceProps = properties
| extend resourceId = tostring(maintenanceProps.resourceId)
) on resourceId
| where isnull(maintenanceProps)
| project recommendationId = "vm-22",name, id, tags
| order by id asc
VM-23 - CPU の完全なパフォーマンスを継続的に必要とする運用 VM には、A または B シリーズの VM SKU を使用しないでください
Category: System Efficiency
Impact: High
Guidance
A シリーズの VM には、開発やテストなどのエントリ レベルのワークロードに最適な CPU パフォーマンスとメモリ構成があります。ユースケースの例としては、開発サーバーとテストサーバー、低トラフィックのWebサーバー、小規模から中規模のデータベース、概念実証、コードリポジトリなどがあります。
B シリーズの VM は、Web サーバー、概念実証、小規模なデータベース、開発ビルド環境など、CPU の完全なパフォーマンスを継続的に必要としないワークロードに最適です。これらのワークロードには、通常、バースト可能なパフォーマンス要件があります。このサイズがデプロイされている物理ハードウェアを特定するには、仮想マシン内から仮想ハードウェアを照会します。B シリーズでは、ベースライン パフォーマンスの VM サイズを購入して、ベースラインよりも少ない使用量のときにクレジットを蓄積できます。VM にクレジットが蓄積されると、アプリケーションでより高い CPU パフォーマンスが必要な場合、VM は vCPU の最大 100% を使用してベースラインを超えてバーストできます。すべての CPU クレジットを消費すると、B シリーズの仮想マシンは、CPU バーストにクレジットが蓄積されるまで、基本 CPU パフォーマンスに調整されます。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VMs using A or B series families
resources
| where type == 'microsoft.compute/virtualmachines'
| where properties.hardwareProfile.vmSize contains "Standard_B" or properties.hardwareProfile.vmSize contains "Standard_A"
| project recommendationId = "vm-23", name, id, tags, param1=strcat("vmSku: " , properties.hardwareProfile.vmSize)
VM-24 - ミッション クリティカルなワークロードでは、Premium ディスクまたは Ultra ディスクを使用する必要があります
Category: System Efficiency
Impact: High
Guidance
Azure Premium SSD は、入出力 (IO) 集中型のワークロードを持つ仮想マシン (VM) に対して、高パフォーマンスで低遅延のディスク サポートを提供します。
Premium SSD v2 は、Premium SSD よりも高いパフォーマンスを提供しながら、一般的にコストも低くなります。Premium SSD v2 ディスクのパフォーマンス (容量、スループット、IOPS) はいつでも個別に調整できるため、変化するパフォーマンス ニーズに対応しながら、ワークロードのコスト効率を高めることができます。V2 は OS ディスクとしてサポートされていないため、Premium ソリッド ステート ドライブ (SSD) をオペレーティング システム (OS) ディスクとして使用する必要があります。
Azure Ultra Disks は、Azure 仮想マシン (VM) 向けの最高パフォーマンスのストレージ オプションです。Ultra ディスクのパフォーマンス パラメーターは、VM を再起動せずに変更できます。 Ultra ディスクは、SAP HANA、最上位データベース、トランザクション負荷の高いワークロードなど、データ集約型のワークロードに適しています。Ultra ディスクはデータ ディスクとして使用する必要があり、空のディスクとしてのみ作成できます。Premium ソリッド ステート ドライブ (SSD) は、オペレーティング システム (OS) ディスクとして使用する必要があります。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all VMs that have an attached disk that is not in the Premium or Ultra sku tier.
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| extend lname = tolower(name)
| join kind=leftouter(resources
| where type =~ 'Microsoft.Compute/disks'
| where not(sku.tier =~ 'Premium') and not(sku.tier =~ 'Ultra')
| extend lname = tolower(tostring(split(managedBy, '/')[8]))
| project lname, name
| summarize disks = make_list(name) by lname) on lname
| where isnotnull(disks)
| project recommendationId = "vm-24", name, id, tags, param1=strcat("AffectedDisks: ", disks)
VM-27 - メンテナンスの機密性の高いワークロードに Azure Boost VM を使用します
Category: Availability
Impact: Medium
Guidance
ワークロードがメンテナンスの影響を受けやすい場合は、Azure Boost 互換 VM の使用を検討してください。 Azure Boost は、Azure メンテナンス アクティビティが発生したときのお客様への影響を軽減するように設計されています。
Resources
Resource Graph Query
// under-development
VM-28 - メンテナンスの影響を受けやすいワークロードの仮想マシンは、スケジュールされたイベントを有効化します
Category: Availability
Impact: Medium
Guidance
ワークロードがメンテナンスの影響を受けやすい場合は、スケジュールされたイベントを有効にしてください。スケジュールされたイベントは、仮想マシンのメンテナンスを準備するための時間をアプリケーションに与える Azure メタデータ サービスです。今後のメンテナンス イベント (再起動など) に関する情報が提供されるため、アプリケーションはそれらに備え、中断を制限できます。これは、Windows と Linux の両方の PaaS と IaaS を含む、すべての種類の Azure Virtual Machines で使用できます。
Resources
- Monitor scheduled events for your Azure VMs
- Azure Metadata Service: Scheduled Events for Linux VMs
- Azure Metadata Service: Scheduled Events for Windows VMs
Resource Graph Query
// under-development