Cómo configurar los servicios iniciadores para seguridad de diálogo anónima (Transact-SQL)

SQL Server utiliza la seguridad de diálogo para cualquier conversación con un servicio para el que existe un enlace de servicio remoto. Si la base de datos que hospeda el servicio de destino no contiene un usuario que corresponda al usuario que crea el diálogo, el diálogo utiliza la seguridad anónima.

Nota de seguridadNota de seguridad

Instale solamente certificados que provengan de fuentes de confianza.

  1. Obtenga un certificado para un usuario de la base de datos remota en un origen de confianza.

  2. Cree un usuario sin inicio de sesión.

  3. Instale el certificado para el servicio remoto. El usuario creado en el paso 3 será el propietario del certificado. De forma predeterminada, el certificado está activo para BEGIN DIALOG.

  4. Cree un enlace de servicio remoto que especifique el usuario y el servicio de destino. En el caso de seguridad de diálogo anónima, el enlace de servicio remoto especifica ANONYMOUS = ON.

Ejemplo

En este ejemplo se configura la seguridad de diálogo anónima para las conversaciones entre el servicio denominado OrderParts de la instancia actual y el servicio denominado SupplierOrders de la instancia remota.

USE AdventureWorks2008R2 ;
GO

-- Given a certificate for a remote user for the remote service
-- SupplierOrders, create a remote service binding for
-- the service.  The remote user will be granted permission
-- to send messages to the local service OrderParts. 
-- This example assumes that the certificate for the service 
-- is saved in the file'C:\Certificates\SupplierOrders.cer' and that
-- the initiating service already exists.


-- Create a user without a login.

CREATE USER [SupplierOrdersUser]
    WITHOUT LOGIN ;
GO

-- Install a certificate for the owner of the service
-- in the remote database. The certificate is
-- provided by the owner of the remote service. The
-- user for the remote service owns the certificate.

CREATE CERTIFICATE [SupplierOrdersCertificate]
    AUTHORIZATION [SupplierOrdersUser]
    FROM FILE='C:\Certificates\SupplierOrders.cer' ;
GO

-- Create the remote service binding. Notice
-- that the user specified in the binding
-- does not own the binding itself.

-- Creating this binding specifies that messages from
-- this database are secured using the certificate for
-- the [SupplierOrdersUser] user.

-- Since anonymous is ON, the credentials for the user
-- that begins the conversation are not used for the
-- conversation.

CREATE REMOTE SERVICE BINDING [SupplierOrdersBinding]
    TO SERVICE 'SupplierOrders'
    WITH USER = [SupplierOrdersUser],
         ANONYMOUS = ON ;
GO