Procedura: Consentire l'accesso alla rete di Service Broker tramite certificati (Transact-SQL)

Si applica a:SQL ServerIstanza gestita di SQL di Azure

Per consentire a un'altra istanza di inviare messaggi usando la sicurezza del trasporto di Service Broker basata su certificati, creare un utente per un'istanza e installare il certificato per l'altra istanza.

Consentire l'accesso da un'altra istanza usando i certificati

  1. Ottenere il certificato per l'altra istanza da un'origine attendibile. In genere, ciò comporta l'invio del certificato tramite posta elettronica crittografata o il trasferimento del certificato su supporti fisici, ad esempio un disco floppy.

    Nota

    Installare solo i certificati da fonti attendibili.

  2. Creare un account di accesso.

  3. Creare un utente per l'account di accesso nel master database.

  4. Installare il certificato per l'altra istanza nel master database. L'utente creato nel passaggio 3 possiede il certificato.

  5. Concedere all'account di accesso CONNECT l'accesso all'endpoint di Service Broker.

  6. Eseguire il dump del certificato usato per la sicurezza del trasporto di Service Broker nell'istanza locale.

    Nota

    Eseguire il dump del certificato usato per la sicurezza del trasporto. Non eseguire il dump o distribuire la chiave privata associata al certificato.

  7. Fornire il certificato all'amministratore dell'altro database. L'amministratore del database remoto installa questo certificato usando i passaggi precedenti da 1 a 4.

Dopo aver configurato l'accesso in ogni istanza, le comunicazioni tra le due istanze useranno la sicurezza del trasporto di Service Broker, se gli endpoint di entrambe le istanze sono configurati per consentirla.

Esempi

USE master;
GO

-- Create a login for the remote instance.
CREATE LOGIN RemoteInstanceLogin WITH PASSWORD = '<password>';
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