Verify “ApplicationIntent=ReadOnly”

Context

A client used “ApplicationIntent=ReadOnly”  in their connection string, expecting queries to execute on the secondary read-only replica. Instead, the queries were executed on the primary database, leading them to suspect an Availability Group misconfiguration.

Diagnostic

To confirm whether the driver sent the read-only intent, we captured the “hadr_read_only_route_preconditions” Extended Event. This event records whether “ReadOnlyIntent = True” arrives at SQL Server:

When we examined the event data, “ReadOnlyIntent” was set to False, confirming the flag never reached the server.

Initial situation: ReadOnlyIntent = False

What Went Wrong?

In this case, although the third-party driver accepted the option “ApplicationIntent=ReadOnly” it wasn’t send to the SQL Server. After upgrading the driver’s to the latest version, the read-only flag appeared at SQL Server and queries were executed on the replica as intended.

After upgrade: ReadOnlyIntent = True

Key Takeaways

  • Audit your stack end-to-end. Availability Group settings are only half the story. Client drivers must support “ApplicationIntent=ReadOnly” to enable read-only routing.
  • Monitor with Extended Events: It helps detect misrouted traffic.
  • Maintain driver governance: Keep client drivers updated and tested for AG compatibility.

 

Leave a Comment

Scroll to Top