Welcome to Microsoft Q&A,
Hello @Aleksey Vitsko I hope you are doing well,
Your KQL query is structurally correct and targets the right table (SQLSecurityAuditEvents). Since the query returns zero results despite purposefully generating failed logins, you are likely encountering the architectural distinction between Database-level and Server-level auditing in Azure SQL.
You must enable Server-level Auditing. Server-level policies automatically apply to all databases on the logical server, specifically including master, which is required to capture server-admin login failures.
- Navigate to your Azure SQL Server resource (the logical server, not the database) in the Azure Portal.
- Under the Security menu on the left, select Auditing.
- Toggle Enable Azure SQL Auditing to ON at this server level.
- Select your Log Analytics workspace and click Save.
Once Server-level auditing is enabled, generate a few more failed logins and wait 5–10 minutes for Log Analytics ingestion. You can optimize your query by filtering on the specific ActionId for failed logins (DBAF) and expanding the AdditionalInformation column to see the exact SQL Error Code:
Code snippet
SQLSecurityAuditEvents
| where Succeeded == false
| where ActionId == "DBAF" or ActionName == "DATABASE AUTHENTICATION FAILED"
| project TimeGenerated, LogicalServerName, DatabaseName, ClientIp, ServerPrincipalName, ApplicationName, ActionName, AdditionalInformation
| order by TimeGenerated desc
😊 If my answer helped you resolve your issue, please consider marking it as the correct answer. This helps others in the community find solutions more easily.