1
0
mirror of https://github.com/Microsoft/sql-server-samples.git synced 2025-12-08 14:58:54 +00:00
Files
sql-server-samples/samples/databases/wide-world-importers/sample-scripts/always-encrypted

Sample for use of Always Encrypted in WideWorldImporters

This script demonstrates the use of Always Encrypted to encrypt sensitive data in the database.

Contents

About this sample
Before you begin
Running the sample
Sample details
Disclaimers
Related links

About this sample

  1. Applies to: SQL Server 2016 (or higher), Azure SQL Database
  2. Key features: Always Encrypted
  3. Workload: OLTP
  4. Programming Language: T-SQL, C#
  5. Authors: Greg Low, Jos de Bruijn
  6. Update history: 26 May 2016 - initial revision

Before you begin

To run this sample, you need the following prerequisites.

Software prerequisites:

  1. SQL Server 2016 (or higher) or Azure SQL Database.
  2. SQL Server Management Studio
  3. Visual Studio 2015
  4. The WideWorldImporters database.

Running the sample

  1. Build the solution to create the data population app.

  2. Open both scripts in different windows or tabs in Management Studio.

  3. Follow the instructions in the main script DemonstrateAlwaysEncrypted.sql.

Sample details

The sample adds a new table with sensitive data about suppliers. This sensitive data is always encrypted.

As part of the sample you create an encryption key that is saved locally (where you run SSMS). The client application inserts data into the table. With the sample scripts you will see how the data is encrypted in the table and cannot be viewed, even by a sysadmin, unless you have the encryption key.

Disclaimers

The code included in this sample is not intended to be used for production purposes.

For more information, see these articles: