Skip to content

Commit d65e270

Browse files
committed
VBS enclaves demo
1 parent 68bda50 commit d65e270

6 files changed

Lines changed: 241 additions & 29 deletions

File tree

samples/features/security/always-encrypted-with-secure-enclaves/azure-sql-database-vbs/README.md

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ You also need to make sure the following software is installed on your machine:
5050
5151
By following the below setup steps, you will create a new resource group and deploy the following resources to your Azure subscription:
5252
- A logical database server.
53-
- The **ContosoHR** database using the [DC-series hardware generation](https://docs.microsoft.com/azure/azure-sql/database/service-tiers-sql-database-vcore#dc-series), which is required for Always Encrypted with secure enclaves.
53+
- The **ContosoHR** database with VBS enclaves enabled.
5454
- A key vault in [Azure Key Vault](https://docs.microsoft.com/azure/key-vault/) and a key to be used as a column master key for Always Encrypted.
5555
- The Contoso HR web application in Azure Web Apps.
56-
- An attestation provider in [Microsoft Azure Attestation](https://docs.microsoft.com/azure/attestation). Your web app will use the attestation provider to attest the enclave in the database.
5756
5857
Setup steps:
5958
@@ -69,14 +68,13 @@ Setup steps:
6968
1. When prompted, enter the following information:
7069
1. Your Azure subscription id. To determine your subscription id, see [Find your Azure subscription](https://docs.microsoft.com/azure/media-services/latest/setup-azure-subscription-how-to?tabs=portal).
7170
1. The project name. The resource group containing all your demo resources will have that name. The project name will also be used as a prefix for the names of all demo resources. Please use only lowercase letters and numbers for the project name and make sure it is unique.
72-
1. The location - it must be one of the Azure regions supporting the DC-series hardware generation, which are listed [here](https://docs.microsoft.com/azure/azure-sql/database/service-tiers-sql-database-vcore#dc-series-1).
71+
1. The location where you want to create the resources.
7372
1. The username and the password of the Azure SQL database server administrator. The setup script will create the server with these admin credentials and it will later use them to connect to the server using SQL authentication for some of the setup steps.
74-
1. When prompted, sign in to Azure. Once you sign in, the script will deploy the demo environment using the provided Bicep template, which may take a few minutes. After the deployment completes, the script performs post-deployment setup steps to configure the database and the attestation policy for Always Encrypted with secure enclaves.
73+
1. When prompted, sign in to Azure. Once you sign in, the script will deploy the demo environment using the provided Bicep template, which may take a few minutes. After the deployment completes, the script performs post-deployment setup steps to configure the database.
7574
1. When prompted, sign in to Azure again, to enable the SqlServer PowerShell module to connect to the database.
7675
1. Finally, the script outputs the important information about your demo environment.
7776
- Database server name (`<project name>server.database.windows.net`)
7877
- Database name (`ContosoHR`)
79-
- Attestation URL (`https://<project name>attest.<region moniker>.attest.azure.net`)
8078
- Application URL (`https://<project name>app.azurewebsites.net/`)
8179

8280
Please copy and save the above information. You will need it for the demo steps.
@@ -111,26 +109,15 @@ Perform the below steps before each demo presentation.
111109
1. Review the content of your demo resource group. It should contain the following resources:
112110

113111
- `<project name>app`- an app service hosting the Contoso HR web application.
114-
- `<project name>attest`- an attestation provider in Microsoft Azure Attestation for attesting the secure enclave for the **ContosoHR** database.
115-
- `<project name>identity` - a user-assigned managed identity that was used to deploy the web application.
116112
- `<project name>plan` - an app service plan for the web application.
117113
- `<project name>server`- a logical server in Azure SQL Database.
118114
- `<project name>vault` - a key vault in Azure Key Vault, containing the column master key for Always Encrypted.
119115
- `ContosoHR` - a database.
120116

121-
1. Right-click on the **ContosoHR** database in the resource group and open its **Overview** blade in the new tab. Click on **Compute + storage** under **Settings**. Click **Change configuration**. Note that the database is already configured to use the DC-series hardware configuration that supports confidential computing using secure enclaves. Setting the DC-series hardware configuration for a database is required to use Always Encrypted with secure enclaves in the database. For more information, see [Enable Intel SGX for your Azure SQL Database](https://docs.microsoft.com/azure/azure-sql/database/always-encrypted-enclaves-enable-sgx).
122-
123-
![DC-series hardware configuration](./img/portal-dc-series-configuration.png)
124-
125-
1. Close the browser tab for the database. Right-click on the attestation provider in your resource group and open its **Overview** blade in a new tab. Click on **Policy** under **Settings**. Select **SGX-IntelSDK** for **Attestation Type**. This will display the attestation policy configured for Intel Software Guard eXtensions (Intel SGX) enclaves. The policy allows a client driver within an application to verify the secure enclave in Azure SQL Database is a genuine Intel SGX enclave and it runs the genuine SQL library that implements Transact-SQL predicates and cryptographic operations of Always Encrypted. For more information, see [Configure Azure Attestation for your Azure SQL logical server](https://docs.microsoft.com/azure/azure-sql/database/always-encrypted-enclaves-configure-attestation).
126-
127-
![DC-series hardware configuration](./img/portal-attestation-policy.png)
128-
129-
1. Close the browser tab for the attestation provider. Right-click on the app service for the Contoso HR web application in your resource group and open its **Overview** blade in a new tab. Click on **Configuration** under **Settings**. In the **Connection strings** section, click **Advanced edit**. This will display the database connection string configured for the web application. There are three important things to call out in the database connection string:
117+
1. Right-click on the app service for the Contoso HR web application in your resource group and open its **Overview** blade in a new tab. Click on **Configuration** under **Application Settings**. In the **Connection strings** section, click **Advanced edit**. This will display the database connection string configured for the web application. There are two important things to call out in the database connection string:
130118

131119
- **Column Encryption Setting = Enabled** turns the Always Encrypted on in the client driver, allowing it to transparently encrypt query parameters and decrypt query results.
132-
- **Attestation Protocol = AAS** specifies Microsoft Azure Attestation is used for attesting the secure enclave for the **ContosoHR** database.
133-
- **Enclave Attestation Url** is an attest URI of the attestation provider.
120+
- **Attestation Protocol = None** specifies that there is no attestation used. VBS enclaves currently do not support attestation.
134121

135122
![Connection string](./img/portal-web-app-connection-string.png)
136123

@@ -139,7 +126,7 @@ Perform the below steps before each demo presentation.
139126

140127
![Connection string](./img/portal-key-vault-key.png)
141128

142-
2. Click on **Access Policies** under **Settings**. You should see two access policy entries: one for your identity and one for the web app's identity. These policies grant you permissions necessary to perform key management operations and they grant the web app permissions required to decrypt column encryption keys, protecting the data.
129+
2. Click on **Access Policies**. You should see two access policy entries: one for your identity and one for the web app's identity. These policies grant you permissions necessary to perform key management operations and they grant the web app permissions required to decrypt column encryption keys, protecting the data.
143130

144131
1. Switch to SSMS.
145132
1. In Object Explorer, navigate to the **ContosoHR** database. Then go to **Security** > **Always Encrypted Keys**.
@@ -148,13 +135,9 @@ Perform the below steps before each demo presentation.
148135

149136
![Connection string](./img/ssms-cmk.png)
150137

151-
### Key Takeaways
152-
153-
Always Encrypted with secure enclaves requires specific hardware that is exposed in Azure SQL Database as the DC-series hardware configuration. Microsoft Azure Attestation is a Platform-as-a-Service solution for attestation enclaves in Azure. Enclaves are attested against a policy, you define and control.
154-
155138
## Demo 2
156139

157-
This short demo highlights the main benefits of Always Encrypted with secure enclaves. The starting point for the demo is the ContosoHR database with the **SSN** and **Salary** columns already encrypted.
140+
This short demo highlights the main benefits of Always Encrypted with VBS enclaves. The starting point for the demo is the ContosoHR database with the **SSN** and **Salary** columns already encrypted.
158141

159142
### Prepare for the demo
160143
Perform the below steps before you show the demo.
@@ -254,7 +237,7 @@ Perform the below steps before you show the demo.
254237
![Selecting database](./img/ssms-explorer-select-database.png)
255238

256239
1. With the **ContosoHR** database selected, click Ctrl + O. In the **Open File** dialog, navigate to the **tsql-scripts** folder and select **ListAllEmployees.sql**. Do not execute the query yet.
257-
1. With the **ContosoHR** database selected, click Ctrl + O. In the **Open File** dialog, navigate to the **tsql-scripts** folder and select **QueryEvents.sql**. Do not execute the query yet.
240+
1. With the **ContosoHR** database selected, click Ctrl + O. In the **Open File** dialog, navigate to the **tsql-scripts** folder and select **QueryXEvents.sql**. Do not execute the query yet.
258241
1. Prepare Security Administrator's instance of SSMS.
259242
1. Start SSMS.
260243
1. In the Connect to Server dialog:
@@ -266,7 +249,7 @@ Perform the below steps before you show the demo.
266249

267250
![Connection Properties](./img/ssms-connect-to-server-connection-properties-page.png)
268251

269-
1. Select the **Always Encrypted** tab. Make sure the **Enable Always Encrypted** checkbox **is** selected. Enter your attestation URL.
252+
1. Select the **Always Encrypted** tab. Make sure the **Enable Always Encrypted** and the **Enable secure enclaves** checkbox are selected. Set the Enclave attestation Protocol to **None**.
270253

271254
![Always Encrypted disabled](./img/ssms-connect-to-server-always-encrypted-enabled.png)
272255

Loading

samples/features/security/always-encrypted-with-secure-enclaves/azure-sql-database-vbs/setup/azuredeploy.bicep

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,10 @@ resource WebApp_Resource 'Microsoft.Web/sites@2022-03-01' = {
141141
resource sourceControl 'Microsoft.Web/sites/sourcecontrols@2022-03-01' = {
142142
name: '${projectName}app/web'
143143
properties: {
144-
repoUrl: 'https://github.com/microsoft/sql-server-samples.git'
145-
branch: 'master'
144+
//repoUrl: 'https://github.com/microsoft/sql-server-samples.git'
145+
repoUrl: 'https://github.com/Pietervanhove/sql-server-samples.git'
146+
//branch: 'master'
147+
branch: 'AEVBSDemo'
146148
isManualIntegration: true
147149
}
148150
dependsOn: [

samples/features/security/always-encrypted-with-secure-enclaves/source/ContosoHR/ContosoHR.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="Azure.Identity" Version="1.4.0" />
17+
<PackageReference Include="Azure.Core" Version="1.27.0" />
18+
<PackageReference Include="Azure.Identity" Version="1.6.0" />
1819
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.6.1" />
1920
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.0.1" />
2021
<PackageReference Include="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider" Version="3.0.0" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"metadata": {
5+
"_dependencyType": "compute.appService.windows"
6+
},
7+
"parameters": {
8+
"resourceGroupName": {
9+
"type": "string",
10+
"defaultValue": "aedemovbs",
11+
"metadata": {
12+
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
13+
}
14+
},
15+
"resourceGroupLocation": {
16+
"type": "string",
17+
"defaultValue": "northeurope",
18+
"metadata": {
19+
"description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support."
20+
}
21+
},
22+
"resourceName": {
23+
"type": "string",
24+
"defaultValue": "aedemovbsapp",
25+
"metadata": {
26+
"description": "Name of the main resource to be created by this template."
27+
}
28+
},
29+
"resourceLocation": {
30+
"type": "string",
31+
"defaultValue": "[parameters('resourceGroupLocation')]",
32+
"metadata": {
33+
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
34+
}
35+
}
36+
},
37+
"variables": {
38+
"appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
39+
"appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]"
40+
},
41+
"resources": [
42+
{
43+
"type": "Microsoft.Resources/resourceGroups",
44+
"name": "[parameters('resourceGroupName')]",
45+
"location": "[parameters('resourceGroupLocation')]",
46+
"apiVersion": "2019-10-01"
47+
},
48+
{
49+
"type": "Microsoft.Resources/deployments",
50+
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
51+
"resourceGroup": "[parameters('resourceGroupName')]",
52+
"apiVersion": "2019-10-01",
53+
"dependsOn": [
54+
"[parameters('resourceGroupName')]"
55+
],
56+
"properties": {
57+
"mode": "Incremental",
58+
"template": {
59+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
60+
"contentVersion": "1.0.0.0",
61+
"resources": [
62+
{
63+
"location": "[parameters('resourceLocation')]",
64+
"name": "[parameters('resourceName')]",
65+
"type": "Microsoft.Web/sites",
66+
"apiVersion": "2015-08-01",
67+
"tags": {
68+
"[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty"
69+
},
70+
"dependsOn": [
71+
"[variables('appServicePlan_ResourceId')]"
72+
],
73+
"kind": "app",
74+
"properties": {
75+
"name": "[parameters('resourceName')]",
76+
"kind": "app",
77+
"httpsOnly": true,
78+
"reserved": false,
79+
"serverFarmId": "[variables('appServicePlan_ResourceId')]",
80+
"siteConfig": {
81+
"metadata": [
82+
{
83+
"name": "CURRENT_STACK",
84+
"value": "dotnetcore"
85+
}
86+
]
87+
}
88+
},
89+
"identity": {
90+
"type": "SystemAssigned"
91+
}
92+
},
93+
{
94+
"location": "[parameters('resourceLocation')]",
95+
"name": "[variables('appServicePlan_name')]",
96+
"type": "Microsoft.Web/serverFarms",
97+
"apiVersion": "2015-08-01",
98+
"sku": {
99+
"name": "S1",
100+
"tier": "Standard",
101+
"family": "S",
102+
"size": "S1"
103+
},
104+
"properties": {
105+
"name": "[variables('appServicePlan_name')]"
106+
}
107+
}
108+
]
109+
}
110+
}
111+
}
112+
]
113+
}

0 commit comments

Comments
 (0)