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
- Applies to: SQL Server 2016 (or higher), Azure SQL Database
- Key features: Always Encrypted
- Workload: OLTP
- Programming Language: T-SQL, C#
- Authors: Greg Low, Jos de Bruijn
- Update history: 26 May 2016 - initial revision
Before you begin
To run this sample, you need the following prerequisites.
Software prerequisites:
- SQL Server 2016 (or higher) or Azure SQL Database.
- SQL Server Management Studio
- Visual Studio 2015
- The WideWorldImporters database.
Running the sample
-
Build the solution to create the data population app.
-
Open both scripts in different windows or tabs in Management Studio.
-
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.
Related Links
For more information, see these articles: