SQL Server 2017 Availability group not routing to secondary server I've set up a dev AlwaysOn environment on SSMS 2017. 
I have my AG set up:





I also ran the following scripts:

ALTER AVAILABILITY GROUP [DEV-SQLAG] MODIFY REPLICA ON N'DEV-DB1' WITH (SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://Dev-DB1.test.com:5022'));

ALTER AVAILABILITY GROUP [DEV-SQLAG] MODIFY REPLICA ON N'DEV-DB2' WITH (SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://Dev-DB2.test.com:5022'));

ALTER AVAILABILITY GROUP [DEV-SQLAG] MODIFY REPLICA ON N'DEV-DB1' WITH (PRIMARY_ROLE (READ_ONLY_ROUTING_LIST = ('DEV-DB2','DEV-DB1')));

ALTER AVAILABILITY GROUP [DEV-SQLAG] MODIFY REPLICA ON N'DEV-DB2' WITH (PRIMARY_ROLE (READ_ONLY_ROUTING_LIST = ('DEV-DB1','DEV-DB2')));


now when I connect to the listener (using SSMS2017) with ApplicationIntent=ReadOnly and I run select @@SERVERNAME it still shows me DEV-DB1. I thought it would show me that I'm getting data from the secondary DEV-DB2

What am I missing?
2 more things to be noted here while you are trying to connect to the Listener via the Management Studio for ReadOnly routing:


Make sure that you are also providing the database Name along with "ApplicationIntent=ReadOnly" in the Additional Connection parameters section of SSMS
SSMS sometimes has sticky connections so it could be possible that it is still connecting to an existing connection that was made via SSMS before providing the parameters "ApplicationIntent=ReadOnly". Try restarting the SSMS.