PowerShell ile Azure Disk Encryption Durumu Denetimi

Azure Disk Encryption, VM disk verilerini şifreleyerek veri güvenliğini sağlar. PowerShell ile tüm VM’lerin disk şifreleme durumunu toplu olarak kontrol edebilirsiniz.

Şifrelenmemiş VM’leri Tespit Etmek

PowerShell

#connect-AzAccount
$allVMs = Get-AzVM
$report = @()
 
foreach ($vm in $allVMs) {
    $encStatus = Get-AzVmDiskEncryptionStatus -ResourceGroupName $vm.ResourceGroupName -VMName $vm.Name
    $report += [PSCustomObject]@{
        VMName          = $vm.Name
        ResourceGroup   = $vm.ResourceGroupName
        OSDisk          = $encStatus.OsVolumeEncryptionSettings.Enabled ?? $false
        DataDisks       = $encStatus.DataVolumesEncryptionStatus -ne "NotEncrypted"
        EncryptionExtension = $encStatus.ProgressMessage
    }
}
 
$unencrypted = $report | Where-Object { -not $_.OSDisk }
Write-Host "Şifrelenmemiş VM sayısı: $($unencrypted.Count)" -ForegroundColor Red
$unencrypted | Format-Table
$report | Export-Csv "disk_encryption_audit.csv" -NoTypeInformation