virtualMachines
Summary
Details
VMSS Flex を使用して 2 つ以上の VM で本番ワークロードを実行する
Impact: High Category: High Availability PG Verified: Verified
Description:
運用 VM ワークロードは複数の VM にデプロイされ、VMSS Flex インスタンスにグループ化されてプラットフォーム全体にインテリジェントに分散され、プラットフォームの障害や更新の影響を最小限に抑える必要があります。
Potential Benefits:
Enhanced fault/update resilience
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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="273f6b30-68e0-4241-85ea-acf15ffb60bf", name, id, tags
可用性ゾーン全体に VM をデプロイする
Impact: High Category: High Availability PG Verified: Verified
Description:
各 Azure リージョン内の Azure 可用性ゾーンは、物理的に分離されているため、ローカル障害に対して耐性があり、起こりそうもないデータセンターの障害からアプリケーションとデータを保護します。
Potential Benefits:
Enhanced VM resilience to failures
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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="2bd0be95-a825-6f47-a8c6-3db1fb5eb387", name, id, tags, param1="No Zone"
可用性セットを使用した VM を VMSS Flex に移行する
Impact: High Category: High Availability PG Verified: Verified
Description:
可用性セットは間もなく廃止されます。ワークロードを VM から VMSS Flex に移行して、ゾーン間または同じゾーン内で異なる障害ドメイン (FD) および更新ドメイン (UD) にまたがって展開することで、信頼性を向上します。
Potential Benefits:
Enhances reliability and future-proofs VMs
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// Azure Resource Graph Query
// Find all VMs using Availability Sets
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| where isnotnull(properties.availabilitySet)
| project recommendationId = "a8d25876-7951-b646-b4e8-880c9031596b", name, id, tags, param1=strcat("availabilitySet: ",properties.availabilitySet.id)
Azure Site Recovery を使用して VM をレプリケートする
Impact: Medium Category: Disaster Recovery PG Verified: Verified
Description:
Site Recovery 経由で Azure VM をレプリケートするには、ターゲット リージョンへの継続的な非同期ディスク レプリケーションが必要になります。復旧ポイントは数分ごとに生成され、数分で目標復旧ポイント (RPO) を達成します。
Potential Benefits:
Minimize downtime in disasters
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// Azure Resource Graph Query
// Find all VMs that do NOT have replication with ASR enabled
resources
| where type =~ "Microsoft.Compute/virtualMachines"
| extend securityType = iif(isnull(properties.securityProfile.securityType), "Standard", properties.securityProfile.securityType)
| where securityType !in~ ("TrustedLaunch", "ConfidentialVM")
| project id, vmIdForJoin = tolower(id), name, tags
| join kind = leftouter (
recoveryservicesresources
| where type =~ "Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"
and properties.providerSpecificDetails.dataSourceInfo.datasourceType =~ "AzureVm"
| project vmResourceId = tolower(properties.providerSpecificDetails.dataSourceInfo.resourceId)
)
on $left.vmIdForJoin == $right.vmResourceId
| where isempty(vmResourceId)
| project recommendationId = "cfe22a65-b1db-fd41-9e8e-d573922709ae", name, id, tags
VM ディスクにマネージド ディスクを使用する
Impact: High Category: High Availability PG Verified: Verified
Description:
Azure は、2025 年 9 月 30 日にアンマネージド ディスクを廃止します。ユーザーは、中断を回避し、サービスの信頼性を維持するために移行を計画する必要があります。
Potential Benefits:
Avoid retirement disruption, enhance reliability
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "122d11d7-b91f-8747-a562-f56b79bcfbdc", name, id, tags
データ ディスク上のホスト データベース データ
Impact: Low Category: Scalability PG Verified: Verified
Description:
データ ディスクは、データベースやその他の重要なデータを保存するために仮想マシンに接続されるマネージド ディスクです。これらのディスクは、選択に従ってラベルが付けられた SCSI ドライブです。
Potential Benefits:
Enhances performance, recovery, migration flexibility
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "4ea2878f-0d69-8d4a-b715-afc10d1e538e", name, id, tags
Azure Backup サービスを使用して VM をバックアップする
Impact: Medium Category: Disaster Recovery PG Verified: Verified
Description:
Azure Backup を使用して仮想マシンのバックアップを有効にし、データを保護して迅速に回復します。このサービスは、Microsoft Azure クラウドからデータをバックアップおよびリカバリするための、シンプルで安全、かつコスト効率の高いソリューションを提供します。
Potential Benefits:
Secure data recovery and backup
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "1981f704-97b9-b645-9c57-33f8ded9261a", name, id, tags
| order by id asc
停止状態の VM を確認する
Impact: Low Category: Governance PG Verified: Verified
Description:
Azure Virtual Machines (VM) インスタンスには、プロビジョニングや電源状態などのさまざまな状態があります。 VM が実行されていない場合は、問題があるか、不要であることを示している可能性があり、削除するとコスト削減につながる可能性があります。
Potential Benefits:
Reduce costs by removing unused VMs
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "98b334c0-8578-6046-9e43-b6e8fce6318e", name, id, tags
高速ネットワーク (AccelNet) を有効にする
Impact: Medium Category: Scalability PG Verified: Verified
Description:
高速ネットワークにより VM への SR-IOV が可能になり、データ パスからホストをバイパスすることでネットワーク パフォーマンスが大幅に向上します。これにより、サポートされている VM タイプでの要求の厳しいネットワーク ワークロードの遅延、ジッター、CPU 使用率が削減されます。
Potential Benefits:
Reduces latency, jitter and CPU use
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "dfedbeb1-1519-fc47-86a5-52f96cf07105", name, id, tags, param1, param2
| order by id asc
AccelNet が有効になっている場合は、GuestOS NIC ドライバーを手動で更新する必要があります
Impact: Low Category: Governance PG Verified: Verified
Description:
Accelerated Networking が有効になっている場合、GuestOS のデフォルトの Azure VNet インターフェイスが Mellanox に置き換えられ、そのドライバーはサードパーティから提供されます。マーケットプレイスのイメージには最新の Mellanox ドライバーが含まれていますが、展開後のドライバーの更新はユーザーの責任です。
Potential Benefits:
Enhanced VM network efficiency
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// cannot-be-validated-with-arg
VM にはパブリック IP が直接関連付けられていてはなりません
Impact: Medium Category: Security PG Verified: Verified
Description:
仮想マシンのアウトバウンド インターネット接続には、高可用性と SNAT ポートのおかげでセキュリティとサービスの回復力を強化するために、NAT ゲートウェイまたは Azure ファイアウォールを使用することをお勧めします。
Potential Benefits:
Enhanced security and service resiliency
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "1f629a30-c9d0-d241-82ee-6f2eb9d42cb4", name, id, tags
| order by id asc
VM ネットワーク インターフェイスと関連サブネットの両方に、ネットワーク セキュリティ グループが関連付けられています
Impact: Low Category: Security PG Verified: Verified
Description:
特別な理由がない限り、2 つの関連付け間の潜在的なルール競合による予期せぬ通信の問題やトラブルシューティングを避けるために、ネットワーク セキュリティ グループをサブネットまたはネットワーク インターフェイスに関連付けるのではなく、両方には関連付けることをお勧めします。
Potential Benefits:
Reduces communication problems
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "82b3cf6b-9ae2-2e44-b193-10793213f676", name=vmName, id = vmId, tags, param1 = strcat("nic-name=", nicName)
IP 転送はネットワーク仮想アプライアンスに対してのみ有効にする必要があります
Impact: Medium Category: Security PG Verified: Verified
Description:
IP 転送により、仮想マシンのネットワーク インターフェイスは、割り当てられた IP アドレス宛てではない、または割り当てられた IP アドレスから発信されたものではないネットワーク トラフィックを送受信できるようになります。
Potential Benefits:
Enhances network appliance function
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "41a22a5e-5e08-9647-92d0-2ffe9ef1bdad", name, id, tags
| order by id asc
顧客の DNS サーバーは仮想ネットワーク レベルで構成する必要があります
Impact: Low Category: Other Best Practices PG Verified: Verified
Description:
環境全体での不整合を防ぐために、仮想ネットワーク レベルで DNS サーバーを構成します。
Potential Benefits:
Ensures DNS consistency
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "1cf8fe21-9593-1e4e-966b-779a294c0d30", name, id, tags
| order by id asc
共有ディスクはクラスタ化されたサーバーでのみ有効にする必要があります
Impact: Medium Category: Other Best Practices PG Verified: Verified
Description:
Azure 共有ディスクを使用すると、クラスター化されたアプリケーションを展開または移行するためにディスクを複数の VM に一度に接続できます。これは、ディスクが VM クラスター メンバー間で共有されている場合にのみ適しています。
Potential Benefits:
Enhances clustered server performance
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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) and properties.maxShares >= 2
| 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 = "3263a64a-c256-de48-9818-afd3cbc55c2a", name, id, tags, param1, param2
| order by id asc
VM ディスクへのネットワーク アクセスは、パブリック アクセスを無効にし、プライベート アクセスを有効に設定する必要があります。
Impact: Low Category: Security PG Verified: Verified
Description:
「パブリック アクセスを無効にしてプライベート アクセスを有効にする」に変更し、プライベート エンドポイントを作成して、直接パブリック アクセスを制限し、接続がプライベートに行われるようにすることでセキュリティを向上させ、データ保護を強化し、潜在的な外部脅威を最小限に抑えることを推奨します。
Potential Benefits:
Enhances VM security and privacy
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "70b1d2be-e6c4-b54e-9959-b1b690f9e485", name, id, tags, param1
| order by id asc
VM が Azure ポリシーに準拠していることを確認する
Impact: Low Category: Governance PG Verified: Verified
Description:
仮想マシン (VM) を安全に保つことは、実行するアプリケーションにとって非常に重要です。これには、VM とアプリケーションの全体的なセキュリティを目的として、さまざまな Azure サービスと機能を使用して VM への安全なアクセスとデータの安全なストレージを確保することが含まれます。
Potential Benefits:
Secure VMs and applications
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// Azure Resource Graph Query
// Find all VMs in "Non-compliant" state with Azure Policies
policyresources
| where type =~ "Microsoft.PolicyInsights/policyStates" and properties.resourceType =~ "Microsoft.Compute/virtualMachines" and properties.complianceState =~ "NonCompliant"
| project
policyDefinitionId = tolower(properties.policyDefinitionId),
policyAssignmentId = tolower(properties.policyAssignmentId),
targetResourceId = tolower(properties.resourceId)
// Join the policy definition details
| join kind = leftouter (
policyresources
| where type =~ "Microsoft.Authorization/policyDefinitions"
| project policyDefinitionId = tolower(id), policyDefinitionDisplayName = properties.displayName
)
on policyDefinitionId
| project policyDefinitionId, policyDefinitionDisplayName, policyAssignmentId, targetResourceId
// Join the policy assignment details
| join kind = leftouter (
policyresources
| where type =~ "Microsoft.Authorization/policyAssignments"
| project policyAssignmentId = tolower(id), policyAssignmentDisplayName = properties.displayName
)
on policyAssignmentId
| project policyDefinitionId, policyDefinitionDisplayName, policyAssignmentId, policyAssignmentDisplayName, targetResourceId
// Join the target resource details
| join kind = leftouter (
resources
| where type =~ "Microsoft.Compute/virtualMachines"
| project targetResourceId = tolower(id), targetResourceIdPreservedCase = id, targetResourceName = name, targetResourceTags = tags
)
on targetResourceId
| project
recommendationId = "c42343ae-2712-2843-a285-3437eb0b28a1",
name = targetResourceName,
id = targetResourceIdPreservedCase,
tags = targetResourceTags,
param1 = strcat("DefinitionName: ", policyDefinitionDisplayName),
param2 = strcat("DefinitionID: ", policyDefinitionId),
param3 = strcat("AssignmentName: ", policyAssignmentDisplayName),
param4 = strcat("AssignmentID: ", policyAssignmentId)
仮想マシンでは Azure Disk Encryption または EncryptionAtHost が有効になっている必要があります
Impact: High Category: Security PG Verified: Verified
Description:
DM-Crypt (Linux) または BitLocker (Windows) を使用して Azure VM ディスクを暗号化するには、Azure Disk Encryption (ADE) を有効にすることを検討してください。さらに、データ セキュリティを強化するために、ホストでの暗号化と機密ディスク暗号化を検討してください。
Potential Benefits:
Enhances data security and integrity
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// under-development
VM インサイトを有効にする
Impact: Low Category: Monitoring and Alerting PG Verified: Verified
Description:
VM Insights は、VM とスケール セットのパフォーマンス、正常性、実行中のプロセス、依存関係を監視します。パフォーマンスのボトルネックやネットワークの問題を特定することで、アプリケーションのパフォーマンスと可用性の予測可能性を高め、問題が他の依存関係に関連しているかどうかを明確にします。
Potential Benefits:
Improves VM performance and health
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "b72214bb-e879-5f4b-b9cd-642db84f36f4", name, id = idVm, tags, param1 = strcat('MonitoringExtension:', extensionName), param2 = strcat('DataCollectionRuleId:', idDcr), param3 = strcat('isPerformanceEnabled:', isPerformanceEnabled)
すべての Azure 仮想マシンの監視を構成する
Impact: Low Category: Monitoring and Alerting PG Verified: Verified
Description:
Azure Monitor メトリックはプラットフォーム メトリックを自動的に受信しますが、リソースとその Azure プラットフォームの詳細な診断と監査を提供するプラットフォーム ログは、収集のために手動でルーティングする必要があります。
Potential Benefits:
Enhanced diagnostics and auditing capability
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "4a9d8973-6dba-0042-b3aa-07924877ebd5", name, id, tags, param1, param2, param3, param4, param5
VM のメンテナンス構成を使用する
Impact: High Category: High Availability PG Verified: Verified
Description:
メンテナンス構成設定を使用すると、ユーザーは更新をスケジュールおよび管理できるため、VM の更新または中断が計画された時間枠内に確実に実行されるようになります。
Potential Benefits:
Scheduled updates for VMs
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "52ab9e5c-eec0-3148-8bd7-b6dd9e1be870",name, id, tags
| order by id asc
一定のフル CPU パフォーマンスが必要な運用環境には A シリーズ VM または B シリーズ VM を使用しないでください。
Impact: High Category: Scalability PG Verified: Verified
Description:
A シリーズ VM は、開発およびテスト サーバー、低トラフィック Web サーバー、小規模から中規模のデータベースなどのユース ケースを含む、開発やテストなどのエントリー レベルのワークロード向けに調整されています。
Potential Benefits:
Ensures full CPU usage for heavy tasks
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the 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 = "3201dba8-d1da-4826-98a4-104066545170", name, id, tags, param1=strcat("vmSku: " , properties.hardwareProfile.vmSize)