Lesson 2: Create a SQL Server Credential
Credential: A SQL Server credential is an object that is used to store authentication information required to connect to a resource outside of SQL Server. Here, SQL Server backup and restore processes use credential to authenticate to the Windows Azure Blob storage service. The Credential stores the name of the storage account and the storage account access key values. Once the credential is created, it must be specified in the WITH CREDENTIAL option when issuing the BACKUP/RESTORE statements. For more information about how to view, copy or regenerate storage account access keys, see Storage Account Access Keys.
For general information about credentials, see Credentials.
For information, on other examples where credentials are used, see Create a SQL Server Agent Proxy.
Create a SQL Server Credential
To create a SQL Server Credential, use the following steps:
Connect to SQL Server Management Studio.
In Object Explorer, connect to the instance of Database Engine that has AdventureWorks2012 database installed, or use your own database you plan to use for this tutorial.
On the Standard tool bar, click New Query.
Copy and paste the following example into the query window, modify as needed.
CREATE CREDENTIAL mycredential WITH IDENTITY= 'mystorageaccount' – this is the name of the storage account you specified when creating a storage account (See Lesson 1) , SECRET = '<storage account access key>' – this should be either the Primary or Secondary Access Key for the storage account (See Lesson 1)
Verify the T-SQL statement and click Execute.
For more information about the Windows Azure Blob storage service for backup concepts and requirements, see Introduction to Key Components and Concepts.