
-- Configure the READ_ONLY_ROUTING_URL
ALTER AVAILABILITY GROUP [SQL2K12-AG1] 
MODIFY REPLICA ON N'SQL2K12-SVR1' 
WITH (SECONDARY_ROLE(READ_ONLY_ROUTING_URL=N'TCP://SQL2K12-SVR1:1433'))

ALTER AVAILABILITY GROUP [SQL2K12-AG1] 
MODIFY REPLICA ON N'SQL2K12-SVR2' 
WITH (SECONDARY_ROLE(READ_ONLY_ROUTING_URL=N'TCP://SQL2K12-SVR2:1433'))

ALTER AVAILABILITY GROUP [SQL2K12-AG1] 
MODIFY REPLICA ON N'SQL2K12-SVR3' 
WITH (SECONDARY_ROLE(READ_ONLY_ROUTING_URL=N'TCP://SQL2K12-SVR3:1433'))

ALTER AVAILABILITY GROUP [SQL2K12-AG1] 
MODIFY REPLICA ON N'SQL2K12-SVR4' 
WITH (SECONDARY_ROLE(READ_ONLY_ROUTING_URL=N'TCP://SQL2K12-SVR4:1433'))

-- Configure the READ_ONLY_ROUTING_LIST (T-SQL)
ALTER AVAILABILITY GROUP [SQL2K12-AG1] 
MODIFY REPLICA ON N'SQL2K12-SVR1' 
WITH (PRIMARY_ROLE(READ_ONLY_ROUTING_LIST=(N'SQL2K12-SVR3', N'SQL2K12-SVR4')))

ALTER AVAILABILITY GROUP [SQL2K12-AG1] 
MODIFY REPLICA ON N'SQL2K12-SVR2' 
WITH (PRIMARY_ROLE(READ_ONLY_ROUTING_LIST=(N'SQL2K12-SVR4', N'SQL2K12-SVR3')))

ALTER AVAILABILITY GROUP [SQL2K12-AG1] 
MODIFY REPLICA ON N'SQL2K12-SVR3' 
WITH (PRIMARY_ROLE(READ_ONLY_ROUTING_LIST=(N'SQL2K12-SVR4', N'SQL2K12-SVR2')))

