Edit

Share via


Troubleshoot Defender for SQL on Machines configuration

Important

This article applies to commercial clouds. If you're using Government clouds, see the Troubleshoot Defender for SQL on Machines configuration government article.

Before starting the troubleshooting steps, you must enable Defender for SQL server on Machines at the subscription or SQL resource level..

Step 1: Required resources and enablement process

Defender for SQL Server on Machines automatically creates the following resources on your machines:

Resource Type Level Created
System Managed Identity (created only if a user-defined managed identity doesn't exist) Virtual machine/Arc-enabled server hosting the SQL server instance
Defender for SQL extension The extension is installed on each virtual machine/Arc-enabled server hosting the SQL server instance

When you enable Defender for SQL Server on a subscription or specified SQL Server, it performs the following actions to protect each SQL Server instance:

  • Creates a system-managed identity if there's no user-managed identity in the subscription.
  • Installs the Defender for SQL extension on the virtual machine/Arc-enabled server hosting the SQL Server.
  • Impersonates the Windows user running the SQL Server service (default sysadmin role) to access the SQL Server instance.

Step 2: Ensure that you fulfilled the prerequisites

Communication: Allow outbound HTTPS traffic over Transmission Control Protocol (TCP) port 443 using Transport Layer Security (TLS) to *.<region>.arcdataservices.com URL. Learn more about URL requirements.

  • Extensions: Ensure these extensions aren't blocked in your environment. Learn more about restricting extensions installation on Windows VMs.

    • Defender for SQL (IaaS and Arc)
      • Publisher: Microsoft.Azure.AzureDefenderForSQL
      • Type: AdvancedThreatProtection.Windows
    • SQL IaaS Extension (IaaS)
      • Publisher: Microsoft.SqlServer.Management
      • Type: SqlIaaSAgent
    • SQL IaaS Extension (Arc)
      • Publisher: Microsoft.AzureData
      • Type: WindowsAgent.SqlServer
  • Supported SQL Server versions - SQL Server 2012 R2 (11.x) and later versions.

  • Supported operating systems- SQL Server 2012 R2 and later versions.

Step 3: Identify and resolve protection misconfigurations at the SQL Server instance Level

Follow the verification process to identify protection misconfigurations on SQL Server instances.

The recommendation The status of Microsoft SQL Servers on Machines should be protected can be used to verify the protection status of SQL Servers, but the recommendation should be remediated at the resource level. Any SQL server that is unprotected is identified in the unhealthy resource section of the recommendation with a protection status listed and a reason.

Important

The recommendation is only updated every 12 hours. To check the real-time status of your machine, you must verify the protection status of each SQL server and perform any troubleshooting if necessary.

Use the corresponding unhealthy reason and recommended actions to resolve the misconfiguration:

Unhealthy reason Recommended action
Missing identity Assign user-defined/system-defined managed identity to the virtual machine/Arc-enabled server hosting the SQL Server instance. No Role-based access control permissions are required.
Defender for SQL extension does not exist Ensure that the Defender for SQL extension isn't blocked by Azure deny policies:
- Publisher: Microsoft.Azure.AzureDefenderForSQL
- Type: AdvancedThreatProtection.Windows
Manually install the Defender for SQL extension on the virtual machine by hosting the SQL Server instance by using the provided script. Ensure you have version 2.X or above.

1. Run this script Set-AzVMExtension -Publisher 'Microsoft.Azure.AzureDefenderForSQL' -ExtensionType  'AdvancedThreatProtection.Windows' -ResourceGroupName 'resourceGroupeName' -VMName <Vm name> -Name 'Microsoft.Azure.AzureDefenderForSQL.AdvancedThreatProtection.Windows' -TypeHandlerVersion '2.0' -Location 'vmLocation' -EnableAutomaticUpgrade $true

2. Run this script to set the context of the right subscription: connect-AzAccount -Subscription SubscriptionId -UseDeviceAuthentication
Defender for SQL extension should be up-to-date Update the extension in the Extensions page in the virtual machine/Arc-enabled server resource.
Error during the installation of the Defender for SQL extension Check the Defender for SQL extension status in the portal for additional information to troubleshoot the issue.
SQL Server instance is inactive Defender for SQL server on Machines can only protect active (running) SQL server instances.
Lack of permissions Ensure that the SQL Server service account is a member of the sysadmin fixed server role on each SQL Server instance (default setting). Learn more about SQL Server service permissions.
Lack of communication Ensure outbound HTTPS traffic on TCP port 443 using Transport Layer Security (TLS) is allowed from the virtual machine/Arc-enabled server to the *.<region>.arcdataservices.com URL. Learn more about URL requirements
SQL server restart is needed Restart the SQL Server instance so that the Defender for SQL Server installation takes effect.
Internal error Please contact support.

Multiple SQL Server instances on the same virtual machine

If you have multiple SQL Server instances installed on the same virtual machine, the recommendation The status of Microsoft SQL Servers on Machines should be protected can't differentiate between instances. To correlate the error message with the corresponding SQL Server instance, check the error message under the Defender for SQL extension. The Defender for SQL extension can display the following reasons for each instance:

  • Restart the SQL Server
  • Check permissions
  • Ensure the SQL Server instance is active
  1. In the Azure portal, search for and select SQL virtual machine.

  2. Select the relevant virtual machine.

  3. Navigate to Settings > Extensions + applications.

    Screenshot that shows where to locate the Extensions and applications section.

  4. Select the relevant extension to view its protection status.

    Screenshot that shows the information screen for the selected extension.

Based on the unhealthy reason listed, take the appropriate action to remediate the issue.

Step 4: Reverify protection status

After completing the remediation of all errors for each SQL Server instance, reverify the protection status of each SQL Server instance.