How to create Microsoft.Sql/servers/securityAlertPolicies using Managed Identity instead of Storage Account access key?

Marcin Słowikowski 35 Reputation points
2025-05-16T09:58:47.07+00:00

Hello,

I am working on IaC (Terraform). I don't fully understand this resource azurerm_mssql_server_security_alert_policy - resource type in Azure "Microsoft.Sql/servers/securityAlertPolicies". I couldn't find it in the Azure Portal. I found some issues on Github about this resource in the azurerm Terraform provider https://github.com/search?q=repo%3Ahashicorp%2Fterraform-provider-azurerm+azurerm_mssql_server_security_alert_policy&type=issues

I wanted to deploy this resource using a Storage Account with Managed Identity instead of a Storage Account access key because MS recommends disabling the access key to use Entra ID for authentication. Could you please give me some information about this resource (to fully understand it and how it works) and whether it is possible to deploy it without an access key? Does it make sense to create this resource without SA properties at all?

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Oury Ba-MSFT 20,911 Reputation points Microsoft Employee Moderator
    2025-06-02T16:54:19.1233333+00:00

    @Marcin Słowikowski

    Regarding your question about the securityAlertPolicies API, this is the old API for enabling Microsoft Defender for SQL on the SQL server. The storage account-related fields mentioned are not relevant anymore. We recommend using the new API: Microsoft.Sql/servers/advancedThreatProtectionSettings. Detailed information can be found here.

    To clarify, SQL Advanced Threat Protection (ATP) does not require a storage account, which means there's no need for managed identity support for this particular purpose. I highly suggest using our new API: Microsoft.Sql/servers/advancedThreatProtectionSettings, and you can enable this simply by setting the state to "Enabled."

     I hope this clears up any confusion. Please let me know if there's anything else you need.

    Regards,

    Oury

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.