Microsoft Defender for Cloud
Cloud and workloads

Enable Microsoft Defender for SQL Servers on Machines at scale

In brief

The article now identifies whether each PowerShell example enables bulk SQL VM Agent registration, refreshes PowerShell links, and updates navigation metadata and wording.

What Defender admins need to know

Admins can select the example matching their default or custom workspace configuration. No action is required.

Summaries are generated from the documentation change itself.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.

When you enable the SQL Servers on Machines component of the Defender for Databases plan, auto-provisioning starts. Auto-provisioning installs and configures the required components, including the Azure Monitor Agent (AMA), SQL IaaS extension, and Defender for SQL extensions. It also configures the workspace, Data Collection Rules (DCRs), and identity when needed.

This article explains how to enable auto-provisioning for Defender for SQL across multiple subscriptions by using a PowerShell script. This processauto-provisioning procedure applies to SQL servers hosted on Azure Virtual Machines (VMs), on-premises environments, and Azure Arc-enabled SQL servers. It also covers optional configurations such as:

The following sample script is applicable when you use aexample enables Defender for SQL on Machines with bulk SQL VM Agent registration (RegisterSqlVmAgnet = $true) and uses the default Log Analytics workspace, data collection rule, and managed identity.

Write-Host "------ Enable Defender for SQL on Machines example ------"
.\EnableDefenderForSqlOnMachines.ps1 -SubscriptionId $SubscriptionId -RegisterSqlVmAgnet $RegisterSqlVmAgnet

The following sample script is applicable when you useexample enables Defender for SQL on Machines without bulk SQL VM Agent registration (RegisterSqlVmAgnet = $false) and specifies a custom Log Analytics workspace, data collection rule, and managed identity.

Write-Host "------ Enable Defender for SQL on Machines example ------"

1. Run the script.

<a name="next-step"></a>
## Next stepsteps

> [!div class="nextstepaction"]
> [Scan your SQL servers for vulnerabilities](defender-for-sql-on-machines-vulnerability-assessment.md)