When testing a Linked Server database connection, I found that I still hit the main database even with ApplicationIntent = ReadOnly in the connection settings.
After further research, I found that the main reason for this was that the default database associated with this login was set to "master". This can be tested by running the following query:
sp_helplogins
To avoid this problem, I now use the following connection options to make sure that I connect to the database replica:
ApplicationIntent=ReadOnly;Database=database-db
In addition, when connecting to the database through a linked server, please use the following query format:
SELECT * FROM [server].[database].[scheme].[table]
source share