sp_Blitz: Added checks for missing read-only routing URL or list #3763
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
Added checks for missing read-only routing URL or list. Closes #3749.
Did not intend to add the read-only routing list check. However, the URL I gave mentions it as a requirement to make read-only routing work so there was no reason to not add it. Besides, it is pretty simple.
I was not too sure where to put these checks in the code, but they are near the most relevant check I could find.
My only concern is that this could return a lot of rows if somebody has something extreme like an 8-node cluster hosting 6 different AGs.
Demo
The change is much shorter than the demo. I promise!
This tests with a clusterless AG on Linux, as requested.
I have not done any Azure tests and probably cannot.
Destroy
Only if you mess up, clear your screen and destroy the containers.
Setup
To start, we create an environment in the broken way we want. This is PowerShell code using dbatools and Docker. If you already have a disposable AG environment, then all that you need to do is delete the read-only routing lists and URLs for that Availability Group and set a replica to be READ_ONLY when secondary. The names that SSMS uses for this don't match what the DMVs use, so don't worry if you're using the GUI for this and have to guess a bit.
Note the one part you need to change.
If the last two lines weren't a total failure, then we are ready.
Verify Broken State
Now that we have a broken environment, confirm it is broken.
Step one, see what the DMVs say.
Good. The column that we want to be blank is blank.
Step two, run a query that should hit the replica, but does not.
Good. It hit box1, which is the primary.
Step three, make sure my first new
sp_Blitzcheck works. You need to install mysp_blitz, so change the file path.This only fires one of the two new check. This is what we expect. Isn't it nice that PowerShell makes this easy to filter and screenshot?
We can also see that the primary and secondary give the same results. That is good.
Fix it
Step four, fix the listener halfway, so we fire only the second new check.
Step five, check
sp_Blitzagain.This is what we expect.
Step six, fix the listener just a little more.
If the above is right, then my new check should fire only for box2.
Step seven, check
sp_Blitzagain.This is as we expected.
Step eight, fix the listener for the last time.
Prove it is fixed
Step nine, hit the secondary through the listener.
This hits box2, as expected. Recall that we hit box1 when we did this earlier.
Step ten, make sure my new
sp_Blitzchecks do not fire.And we're done!
As a bonus, it is good to know that although SQL Server 2025 lets us revert to the default

READ_ONLY_ROUTING_URLofNONE, there are safeguards to prevent us breaking a routing list when we do that.To destroy,