text: CREATE ENDPOINT [Hadr_endpoint]
      AS TCP (LISTENER_IP = ALL, LISTENER_PORT = 5022)
      FOR DATABASE_MIRRORING (
          ROLE = WITNESS,
          AUTHENTICATION = CERTIFICATE dbm_certificate,
          ENCRYPTION = REQUIRED ALGORITHM AES
          )
  GO
  ALTER ENDPOINT [Hadr_endpoint] STATE = STARTED
  GO
  GRANT CONNECT ON ENDPOINT::[Hadr_endpoint] TO [dbm_login]
  GO