-- Scott bld, remote office where satallite link is

USE [master]
GO

CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'P@ssw0rd'
GO
/****** Object:  Database [Maintenance]    Script Date: 10/26/2005 11:19:17 ******/

/****** Object:  Database [Maintenance]    Script Date: 10/26/2005 11:19:17 ******/
IF  EXISTS (SELECT name FROM sys.databases WHERE name = N'Operations')
DROP DATABASE Operations
GO

CREATE DATABASE Operations
GO
ALTER DATABASE Operations
SET ENABLE_BROKER
GO
ALTER DATABASE Operations
SET RECOVERY SIMPLE
GO
-- must be trustworthy to communicate with others
ALTER DATABASE Operations
SET TRUSTWORTHY ON



-- needs cert in master to be able to authenticate by cert
CREATE CERTIFICATE [Scott Bld] 
WITH SUBJECT = 'Scott Bld'


-- save the public version for others to use
BACKUP CERTIFICATE [Scott Bld] 
TO FILE = 'C:\ScottBld.crt'

-- need endpoint based on cert auth
CREATE ENDPOINT [Scott Bld EP]
STATE = STARTED
AS TCP (LISTENER_PORT = 5700)
FOR SERVICE_BROKER (AUTHENTICATION = CERTIFICATE [Scott Bld])

-- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>



-- need login and user for every other SB we are going to talk to

CREATE LOGIN [Parker Street SB] WITH PASSWORD = 'P@ssw0rd'
CREATE USER [Parker Street SB]
CREATE CERTIFICATE [Parker StreetCert] AUTHORIZATION [Parker Street SB]
FROM FILE = 'C:\ScottBld\ParkerStreet.crt'
GRANT CONNECT ON ENDPOINT::[Scott Bld EP]
TO [Parker Street SB]




