• if you're going to all the trouble of first opening the AG properties and setting the secondaries to Read_Intent, then you do not need to run this part of the script for each replica

    ALTER AVAILABILITY GROUP [AGTEST01] MODIFY REPLICA ON N'DB2' WITH (SECONDARY_ROLE (ALLOW_CONNECTIONS = READ_ONLY));

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉