:CONNECT SQL2K16-BAG01

USE [master]
GO
ALTER AVAILABILITY GROUP [SQL2K16-BAG1] FAILOVER;
GO
DROP AVAILABILITY GROUP [SQL2K16-BAG1];
GO

ALTER EVENT SESSION [AlwaysOn_health] ON SERVER STATE=STOP;
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER WITH (STARTUP_STATE=OFF);
GO

DROP ENDPOINT [Hadr_endpoint];
GO

DROP CERTIFICATE BAG01_cert;
GO
DROP CERTIFICATE BAG02_cert ;
GO

DROP MASTER KEY;
GO
DROP USER BAG02_user
GO
DROP LOGIN BAG02_login;  
GO  



:CONNECT SQL2K16-BAG02

ALTER EVENT SESSION [AlwaysOn_health] ON SERVER STATE=STOP;
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER WITH (STARTUP_STATE=OFF);
GO

DROP ENDPOINT [Hadr_endpoint];
GO

DROP DATABASE ConfigDB;
GO

DROP CERTIFICATE BAG01_cert;
GO
DROP CERTIFICATE BAG02_cert ;
GO

DROP MASTER KEY;
GO
DROP USER BAG01_user
GO
DROP LOGIN BAG01_login;  
GO  

