All scripts
Azure AI 774

Get-AzureAvailabilitySetReport

Lists every availability set with the VMs assigned to it and how many fault and update domains are actually in use, so a set with only one VM (defeating its purpose) gets flagged.

Get-AzureAvailabilitySetReport.ps1
<#
.SYNOPSIS
    Reports availability set configuration and VM membership.

.DESCRIPTION
    Lists every availability set with its fault and update domain count
    and the VMs assigned to it, flagging sets with only one VM, since a
    single VM availability set provides no actual redundancy and usually
    means the set was never fully used as intended.

.EXAMPLE
    .\Get-AzureAvailabilitySetReport.ps1

.NOTES
    Requires the Az.Compute module and an active Connect-AzAccount session.

.AUTHOR
    Shehryar Hassan
#>

$sets = Get-AzAvailabilitySet

$report = $sets | Select-Object Name, ResourceGroupName, PlatformFaultDomainCount, PlatformUpdateDomainCount,
    @{N="VMCount";E={$_.VirtualMachinesReferences.Count}}

$report | Format-Table -AutoSize
$report | Where-Object VMCount -le 1 | ForEach-Object { Write-Warning "$($_.Name) has $($_.VMCount) VM(s), providing no real redundancy." }

Read it before you run it, and test in a safe tenant first.