I know I can use the dashboard - "View AlwaysOn Health Events" - to display the values for availability_replica_state_changes but is there any Tsql I can use to query the dmvs to let me know when the replica state changes for a given availability group?
I'm looking for a script that will tell me when a replica goes from primary to secondary and vice versa. Need to see when the replica state changes and failovers have occurred.
Thanks for any help, Mary