Test-DbaAgPolicyState - Add new command for Always On policy state checks#10246
Test-DbaAgPolicyState - Add new command for Always On policy state checks#10246andreasjordan wants to merge 2 commits intodevelopmentfrom
Conversation
…ecks Implements the first 7 of the 13 predefined Microsoft Always On policies (server and availability group facets) as a starting point. Covers: - WSFC Cluster State (Critical, Server facet) - Availability Group Online State (Critical, AG facet) - Availability Group Automatic Failover Readiness (Critical, AG facet) - Availability Replicas Connection State (Warning, AG facet) - Availability Replicas Data Synchronization State (Warning, AG facet) - Availability Replicas Role State (Warning, AG facet) - Synchronous Replicas Data Synchronization State (Warning, AG facet) Each policy uses the AvailabilityGroupState SMO object and returns IsHealthy as a boolean along with PolicyName, Category, Facet, Issue, and Details. Related to #9911 (do Test-DbaAgPolicyState) Co-authored-by: Andreas Jordan <andreasjordan@users.noreply.github.com>
|
I will close #10233 and #10234 and @ReeceGoding and I will try to use this pull request as a starting point. I will test this tomorrow in my lab. @ReeceGoding feel free to test as well and to add comments here with things we should change. |
|
"Issue" is always filled with the suitable text if IsHealthy is $false. Sould we set "Issue" to $null if IsHealthy is $true? |
|
The parameters $Secondary and $SecondarySqlCredential are currently not used. If they are never used, we should remove them. |
|
@claude please read our comments. Then implement all the over policies, but also only fill the Issue property in case there is an issue. |
|
Claude finished @andreasjordan's task in 4m 56s —— View job Changes implemented
SummaryAll 13 predefined Always On policies are now implemented. Here's what changed:
New output properties: Added 6 new policies added (replica-level):
(database-level):
| |
…, add Refresh - Add 6 remaining policies: Availability Replica Role/Connection/Joined State and Availability Database Synchronization/Suspension/Join State - Fix Issue property to be null when IsHealthy is true (only populate on failure) - Add Replica and Database output properties for replica/database-level policies - Add $ag.Refresh() to ensure current state is evaluated - Update .OUTPUTS documentation to reflect new properties (do Test-DbaAgPolicyState) Co-authored-by: Andreas Jordan <andreasjordan@users.noreply.github.com>
|
I think it should return also the healthy stuff like other |
|
The ClusterQuorumState is maybe missleading. In my test I use |
|
But I think this is a good starting point and ready to be published so people can test this in their enviroments. |




Creates a new
Test-DbaAgPolicyStatecommand that evaluates SQL Server Availability Groups against Microsoft's predefined Always On policies.Implements the first 7 of 13 predefined policies (server and AG facets) as a starting point, all using the
AvailabilityGroupStateSMO object.Related to #9911
Generated with Claude Code