Condividi tramite


Procedura: Consentire l'accesso alla rete di Service Broker tramite i 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.

Per 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, come 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 database master.

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

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

  6. Eseguire il dump del certificato utilizzato 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 e non distribuire la chiave privata associata al certificato.

  7. Fornire il certificato all'amministratore dell'altro database. L'amministratore del database remoto installa questo certificato seguendo i precedenti passaggi 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.

Esempio

    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

Vedi anche