CREATE CREDENTIAL (Transact-SQL)
Creates a credential.
Specifies the name of the credential being created. credential_name cannot start with the number (#) sign. System credentials start with ##.
- IDENTITY = 'identity_name'
Specifies the name of the account to be used when connecting outside the server.
- SECRET = 'secret'
Specifies the secret required for outgoing authentication. This clause is optional.
A credential is a record that contains the authentication information that is required to connect to a resource outside SQL Server. Most credentials include a Windows user and password.
When IDENTITY is a Windows user, the secret can be the password. The secret is encrypted using the service master key. If the service master key is regenerated, the secret is re-encrypted using the new service master key.
After creating a credential, you can map it to a SQL Server login by using CREATE LOGIN or ALTER LOGIN. A SQL Server login can be mapped to only one credential, but a single credential can be mapped to multiple SQL Server logins. For more information, see Credentials.
Information about credentials is visible in the sys.credentials catalog view.
The following example creates the credential called
AlterEgo. The credential contains the Windows user
RettigB and password
CREATE CREDENTIAL AlterEgo WITH IDENTITY = 'RettigB', SECRET = 'sdrlk8$40-dksli87nNN8'; GO