You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/app-service/app-service-encrypt-at-rest-using-cmk.md
+15-8Lines changed: 15 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,23 +11,26 @@ Encrypting your web app's application data at rest requires an Azure Storage Acc
11
11
12
12
-[Azure Storage provides encryption at rest](../storage/common/storage-service-encryption.md). You can use system-provided keys or your own, customer-managed keys. This is where your application data is stored when it's not running in a web app in Azure.
13
13
-[Running from a deployment package](deploy-run-package.md) is a deployment feature of App Service. It allows you to deploy your site content from an Azure Storage Account using a Shared Access Signature (SAS) URL.
14
-
-[Key Vault references](app-service-key-vault-reference.md) are a security feature of App Service. It allows you to import secrets at runtime as app settings. Use this to encrypt the SAS URL of your Azure Storage Account.
14
+
-[Key Vault references](app-service-key-vault-reference.md) are a security feature of App Service. It allows you to import secrets at runtime as application settings. Use this to encrypt the SAS URL of your Azure Storage Account.
15
15
16
16
## Create an Azure Storage account
17
-
18
-
First, follow [these instructions](../storage/common/storage-service-encryption.md#customer-managed-keys-with-azure-key-vault) to create an Azure Storage account and encrypt it with customer managed keys. Once the storage account is created, use the [Azure Storage Explorer](../vs-azure-tools-storage-manage-with-storage-explorer.md) to upload package files.
19
17
20
-
Next, use the Storage Explorer to [generate an SAS](../vs-azure-tools-storage-manage-with-storage-explorer.md?tabs=windows#generate-a-sas-in-storage-explorer). Save this SAS URL, this is used later to enable secure access of the deployment package at runtime.
18
+
First, [create an Azure Storage account](../storage/common/storage-account-create.md) and [encrypt it with customer managed keys](../storage/common/storage-service-encryption.md#customer-managed-keys-with-azure-key-vault). Once the storage account is created, use the [Azure Storage Explorer](../vs-azure-tools-storage-manage-with-storage-explorer.md) to upload package files.
19
+
20
+
Next, use the Storage Explorer to [generate an SAS](../vs-azure-tools-storage-manage-with-storage-explorer.md?tabs=windows#generate-a-sas-in-storage-explorer).
21
+
22
+
> [!NOTE]
23
+
> Save this SAS URL, this is used later to enable secure access of the deployment package at runtime.
21
24
22
25
## Configure running from a package from your storage account
23
26
24
-
Once you upload your file to Blob storage and have an SAS URL for the file, set the `WEBSITE_RUN_FROM_PACKAGE`app setting to the SAS URL. The following example does it by using Azure CLI:
27
+
Once you upload your file to Blob storage and have an SAS URL for the file, set the `WEBSITE_RUN_FROM_PACKAGE`application setting to the SAS URL. The following example does it by using Azure CLI:
25
28
26
29
```
27
30
az webapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings WEBSITE_RUN_FROM_PACKAGE="<your-SAS-URL>"
28
31
```
29
32
30
-
Adding this app setting causes your web app to restart. After the app has restarted, browse to it and make sure that the app has started correctly using the deployment package. If the application didn't start correctly, see the [Run from package troubleshooting guide](deploy-run-package.md#troubleshooting).
33
+
Adding this application setting causes your web app to restart. After the app has restarted, browse to it and make sure that the app has started correctly using the deployment package. If the application didn't start correctly, see the [Run from package troubleshooting guide](deploy-run-package.md#troubleshooting).
31
34
32
35
## Encrypt the application setting using Key Vault references
33
36
@@ -47,13 +50,13 @@ Now you can replace the value of the `WEBSITE_RUN_FROM_PACKAGE` application sett
47
50
az keyvault secret set --vault-name "Contoso-Vault" --name "external-url" --value "<SAS-URL>"
48
51
```
49
52
50
-
1. Use the following [`az webapp config appsettings set`](/cli/azure/webapp/config/appsettings#az-webapp-config-appsettings-set) command to create the `WEBSITE_RUN_FROM_PACKAGE` app setting with the value as a Key Vault reference to the external URL:
53
+
1. Use the following [`az webapp config appsettings set`](/cli/azure/webapp/config/appsettings#az-webapp-config-appsettings-set) command to create the `WEBSITE_RUN_FROM_PACKAGE` application setting with the value as a Key Vault reference to the external URL:
51
54
52
55
```azurecli
53
56
az webapp config appsettings set --settings WEBSITE_RUN_FROM_PACKAGE="@Microsoft.KeyVault(SecretUri=https://Contoso-Vault.vault.azure.net/secrets/external-url/<secret-version>"
54
57
```
55
58
56
-
Updating this app setting causes your web app to restart. After the app has restarted, browse to it make sure it has started correctly using the Key Vault reference.
59
+
Updating this application setting causes your web app to restart. After the app has restarted, browse to it make sure it has started correctly using the Key Vault reference.
57
60
58
61
## Summary
59
62
@@ -67,6 +70,10 @@ If you need to revoke the web app's access to your storage account, you can eith
67
70
68
71
Only the cost associated with the Azure Storage Account and any applicable egress charges.
69
72
73
+
### What happens if the SAS token expires or rotates?
74
+
75
+
If the SAS URL is invalidated for any reason, the web app will continue to run with the last downloaded version of the package file. You must update the value of `WEBSITE_RUN_FROM_PACKAGE` with the new SAS URL for the web app to reestablish a connection to the storage account.
76
+
70
77
### How does running from the deployment package affect my web app?
71
78
72
79
- Running your app from the deployment package makes `wwwroot/` read-only. Your app receives an error when it attempts to write to this directory.
0 commit comments