次の方法で共有


対象サービスを匿名ダイアログ セキュリティ用に構成する方法 (Transact-SQL)

SQL Server では、発信側サービスをホストするデータベース内のリモート サービス バインドが存在するサービスとの任意のメッセージ交換に、ダイアログ セキュリティが使用されます。リモート サービス バインドに ANONYMOUS = ON が指定されている場合は、ダイアログで匿名セキュリティが使用されます。この場合、対象データベースに発信側サービスのユーザーが含まれている必要はありません。発信側サービスは、対象データベースで public として機能します。

対象サービスを匿名ダイアログ セキュリティ用に構成するには

  1. ログインのないユーザーを作成します。

  2. ユーザーの証明書を作成します。

    注意

    証明書はマスター キーで暗号化する必要があります。詳細については、「CREATE MASTER KEY (Transact-SQL)」を参照してください。

  3. 証明書をファイルにバックアップします。

    セキュリティに関する注意セキュリティに関する注意

    このユーザーの証明書のみをバックアップします。証明書に関連付けられた秘密キーは、バックアップまたは配布しないでください。

  4. 対象サービスのユーザーに、対象サービスが使用するキューからメッセージを受信する権限を与えます。

  5. 対象サービスにメッセージを送信する権限を public に与えます。

  6. 対象サービスの証明書および名前を、リモート データベースの管理者に通知します。

使用例

USE AdventureWorks2008R2 ;
GO

--------------------------------------------------------------------
-- This script configures security for a local user in the database.
-- The script creates a user in this database, creates a certificate
-- for the user, writes the certificate to the file system, and
-- grants permissions to the user. Since this service is a target
-- service, no remote service binding is necessary.

-- Create a user without a login. For convenience,
-- the name of the user is based on the name of the
-- the remote service.

CREATE USER [SupplierOrdersUser]
    WITHOUT LOGIN;
GO

-- Create a certificate for the initiating service
-- to use to send messages to the target service.

CREATE CERTIFICATE [SupplierOrdersCertificate]
    AUTHORIZATION [SupplierOrdersUser]
    WITH SUBJECT = 'Certificate for the SupplierOrders service user.';
GO

-- Backup the certificate. Provide the certificate file
-- to the administrator for the database that hosts
-- the other service.

BACKUP CERTIFICATE [SupplierOrdersCertificate]
   TO FILE = 'C:\Certificates\SupplierOrders.cer';
GO

-- Grant receive on the orders queue to the local user.

GRANT RECEIVE ON SupplierOrdersQueue
    TO [SupplierOrdersUser];
GO

-- Grant send on the service to public.

GRANT SEND ON SERVICE::[SupplierOrders] TO public ;