USE master ;
GO
-- Create a login for the remote instance.
CREATE LOGIN RemoteInstanceLogin
WITH PASSWORD = '#gh!3A%!1@f' ;
GO
-- Create a user for the login in the master database.
CREATE USER RemoteInstanceUser
FOR LOGIN RemoteInstanceLogin ;
GO
-- Load the certificate from the file system. Notice that
-- the login owns the certificate.
CREATE CERTIFICATE RemoteInstanceCertificate
AUTHORIZATION RemoteInstanceUser
FROM FILE='C:\Certificates\AceBikeComponentsCertificate.cer' ;
GO
GRANT CONNECT ON ENDPOINT::ThisInstanceEndpoint to RemoteInstanceLogin ;
GO
-- Write the certificate from this instance
-- to the file system. This command assumes
-- that the certificate used by the Service Broker
-- endpoint is named TransportSecurity.
BACKUP CERTIFICATE TransportSecurity
TO FILE = 'C:\Certificates\ThisInstanceCertificate.cer' ;
GO