SQL Azure Firewall setting

JoelP 346 Reputation points
2025-03-06T03:20:48.39+00:00

Hi,

We received a brute force attack notification for our SQL Azure server. Upon investigation, we noticed that the attacker was using .Net SqlClient and returning error 18456.

User's image

If I check error 18456, it refers to failed authentication... but strange as we have server firewall settings and AAD only authentication... I would have expected that the error should be related to network instance not found... etc..

It looks like authentication happens first, then firewall validation... can anyone advise?

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. PratikLad 240 Reputation points Microsoft External Staff
    2025-03-07T09:57:42.2933333+00:00

    Hi @joelp,

    When you have only AAD authentication enabled in your server, first it checks the user is used to authenticate is AAD user or not and Authentication types is AAD authentication or not. If it is not, then it will throw the 18456 (authentication failure error).

    Authentication Flow in Azure SQL When Only AAD authentication is enabled

    1. Authentication Attempt: When a client tries to connect, Azure SQL first checks authentication Type and User. The user is used to authenticate is AAD user or not and Authentication types is AAD authentication or not
    2. Firewall Validation: If authentication fails, the process stops. However, if Everything is correct then only Azure SQL evaluate firewall rules and networking restrictions.

    Why You See Error 18456 Instead of a Network Error?

    • As per you have shared the logs image, The brute force attack is trying different Users which are not looking as AAD users for an existing database.
    • Since the authentication process runs first, Azure SQL returns error 18456 (Login Failed) before it even checks firewall rules.
    • If the authentication had passed, but the firewall blocked the connection, you would see a different error like:
      • A network-related or instance-specific error occurred.
    0 comments No comments

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.