CREATE CREDENTIAL SYNTAX – SQL SERVER

CREATE CREDENTIAL SYNTAX:

Syntax for creating credentials:
[sql]
CREATE CREDENTIAL credentialname WITH IDENTITY = ‘identity_name’
, SECRET = ‘secret’
FOR CRYPTOGRAPHIC PROVIDER cryptographic_provider_name
[/sql]

credentialname – Name of the credential, this is used for refereceing the credential
IDENTITY – This is basically the username
SECRET – Password of the identity/username.
CRYPTOGRAPHIC PROVIDER – Name of Enterprise Key Management Provider.

SECRET and cryptographic_provider_name are optional in the above syntax.

Example:
[sql]
USE [master]
GO
CREATE CREDENTIAL [credential1] WITH IDENTITY = N’username’, SECRET = N’password’
GO
[/sql]

CRYPTOGRAPHIC PROVIDER can be created and used with credentials.

Syntax for creating CRYPTOGRAPHIC PROVIDER:
[sql]
CREATE CRYPTOGRAPHIC PROVIDER provider_name
FROM FILE = ‘path of the dll’
[/sql]

The dll provided above should implement SQL Server Extensible Key Management interface.

CREATING CREDENTIAL USING SQL SERVER MANAGEMENT STUDIO:

  • Open SSMS and connect to the server in object explorer.
  • Expand server and Security
  • In Security Expand

    Create Credential
    Expand Security
  • Right Click on “Credentials” and click on “New Credential…”

    Click on new credential
    Click On New Credential
  • Now a New Credential Window will pop up

    New Credential Window
    New Credential Window
  • Now Enter values for Credential Name, Identity, Password.
    Password and Confirm password must match.
  • Now click on OK.

Thats all.. Now you are done creating a sql server credential.. 🙂