Hi Harry Erbe
There is no predefined policy definition for this specific SQL extension. To enforce compliance, you will need to create a custom policy.
please refer below article
https://learn.microsoft.com/en-us/azure/governance/policy/tutorials/create-custom-policy-definition
This can be achieved using PowerShell
I have created PowerShell script to install SQL extensions on multiple VM's
<#
.SYNOPSIS
This script registers SQL Server VMs in Azure by installing the SQL IaaS extension on specified VMs.
.DESCRIPTION
The script retrieves details of each VM from Azure and registers them as SQL Server VMs.
It checks for errors such as VM not found, missing properties, or failure during registration.
.NOTES
Provide the SQL Server license type as either pay-as-you-go (PAYG) to pay per usage, Azure Hybrid Benefit (AHUB) to use your own license.
Requirements: Azure PowerShell Module (Az)
#>
# List of VM Names to register as SQL VMs
$vms = @("VM01", "VM02")
# Loop through each VM
foreach ($vm in $vms) {
try {
# Get the VM details
$vmDetails = Get-AzVM | Where-Object { $_.Name -eq $vm }
# Check if VM exists
if (-not $vmDetails) {
Write-Host "ERROR: VM '$vm' not found in Azure." -ForegroundColor Red
continue
}
# Attempt to register the VM with SQL IaaS extension
Write-Host "Registering SQL Server VM: $($vmDetails.Name)..." -ForegroundColor Yellow
New-AzSqlVM -Name $vmDetails.Name -ResourceGroupName $vmDetails.ResourceGroupName -Location $vmDetails.Location -LicenseType AHUB
Write-Host "Successfully registered $($vmDetails.Name) as a SQL Server VM." -ForegroundColor Green
}
catch {
Write-Host "ERROR: Failed to register VM '$vm'. Error: $_" -ForegroundColor Red
}
}
Please do not forget to "Accept the answer” and “upvote it” wherever the information provided helps you, this can be beneficial to other community members.it would be greatly appreciated and helpful to others.