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/key-vault/key-vault-key-rotation-log-monitoring.md
+6-11Lines changed: 6 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,21 +18,16 @@ ms.author: mbaldwin
18
18
19
19
After you have a key vault, you can start using it to store keys and secrets. Your applications no longer need to persist your keys or secrets, but can request them from the vault as needed. A key vault allows you to update keys and secrets without affecting the behavior of your application, which opens up a breadth of possibilities for your key and secret management.
20
20
21
-
>[!IMPORTANT]
22
-
> The examples in this article are provided for illustration purposes only. They're not intended for production use.
21
+
This article walks through how to implement a scheduled rotation of storage account keys, monitor the key vault audit logs, and raise alerts when unexpected requests are made.
23
22
24
-
This article walks through:
23
+
You must first create a key vault using the method of your choice:
25
24
26
-
-An example of using Azure Key Vault to store a secret. In this article, the secret stored is the Azure storage account key accessed by an application.
27
-
-How to implement a scheduled rotation of that storage account key.
28
-
-How to monitor the key vault audit logs and raise alerts when unexpected requests are made.
25
+
-[Set and retrieve a secret from Azure Key Vault using Azure CLI](quick-create-cli.md)
26
+
-[Set and retrieve a secret from Azure Key Vault using Azure PowerShell](quick-create-powershell.md)
27
+
-[Set and retrieve a secret from Azure Key Vault using Azure portal](quick-create-portal.md)
29
28
30
-
> [!NOTE]
31
-
> This article doesn't explain in detail the initial setup of your key vault. For this information, see [What is Azure Key Vault?](key-vault-overview.md). For cross-platform command-line interface instructions, see [Manage Key Vault using the Azure CLI](key-vault-manage-with-cli2.md).
Copy file name to clipboardExpand all lines: articles/key-vault/tutorial-rotation.md
+55-33Lines changed: 55 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,59 +12,81 @@ ms.date: 01/26/2020
12
12
ms.author: mbaldwin
13
13
14
14
---
15
-
# Single User/Password Rotation Tutorial
16
-
Single User/Password Rotation Tutorial
15
+
# Automate the rotation of a single user/password secret
17
16
18
-
The best option to authenticate to Azure services is by using Managed Identity. There are scenarios where Managed Identity is not an option and then access keys or secrets are used. In those scenarios access keys or secrets should be periodically rotated.
19
-
This tutorial demonstrates how to automate periodic rotation (30 days before expiry) of secrets for databases and services with single user/password authentication. Below scenario would rotate SQL server password stored in key vault using function triggered by event grid notification.
17
+
Although the best way to authenticate to Azure services is by using an [managed identity](managed-identity.md), there are some scenarios where this is not an option. In these cases, access keys or secrets are used. Access keys or secrets should be periodically rotated.
18
+
19
+
This tutorial demonstrates how to automate the periodic rotation of secrets for databases and services with single user/password authentication. Specifically, this scenario rotates SQL server passwords stored in key vault using a function triggered by Event Grid notification:
20
20
21
21

22
22
23
-
1. Key Vault publish near expiry event to Event Grid 30 days before expiration date
24
-
1. Event Grid checks event subscriptions and calls (http post) Function App endpoint subscribed to this event
25
-
1.Function App receives secret information, generates new random password and create new version for that secret with new password in Key Vault
26
-
1.Function App updates SQL with new password
23
+
1.Thirty days before 30 days before the expiration date of a secret, Key Vault publish the "near expiry" event to Event Grid .
24
+
1. Event Grid checks the event subscriptions and, using http post, calls the Function App endpoint subscribed to this event.
25
+
1.The function App receives secret information, generates new random password, and create a new version for the secret with a new password in Key Vault.
26
+
1.The function App updates SQL with new password.
27
27
28
28
Note: There could be a lag between step 3 and 4 and during that time secret in Key Vault would not be valid to authenticate to SQL. In case of failure in any of the steps Event Grid retries for 2 hours.
29
29
30
-
## Infrastructure setup
31
-
Before required steps for rotation are demonstrated we need initial infrastructure setup to imitate common environment.
32
-
Create resource group with Key Vault, SQL Server and store admin password in Key Vault as secret.
33
-
This tutorial would use pre-created Azure Resource Manager template to create components. You can find entire code here(Basic Secret Rotation Template Sample).
34
-
Components List:
35
-
- Key Vault
36
-
- SQL Server
30
+
## Setup
37
31
38
-
Azure Resource Manager template to create components: [Deploy](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fjlichwa%2Fazure-keyvault-basicrotation-tutorial%2Fmaster%2Farm-templates%2Finitial-setup%2Fazuredeploy.json)
39
-
- Create new resource group like below
40
-
- Click Purchase
32
+
## Create a key vault and SQL server
41
33
42
-

34
+
Before we begin, we must create a Key Vault, create a SQL Server and database, and store the SQL Server admin password in Key Vault.
43
35
44
-
For simplicity you can run below deployment to create all components and configuration at once and skip to step 3:
45
-
Components List:
46
-
- Key Vault
47
-
- SQL Server
48
-
- App Service Plan
49
-
- Function App
50
-
- Storage Account
51
-
- Web App
52
-
Azure Resource Manager template to create components: [Deploy](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fjlichwa%2Fazure-keyvault-basicrotation-tutorial%2Fmaster%2Farm-templates%2Fall%2Fazuredeploy.json)
36
+
This tutorial uses a pre-created Azure Resource Manager template to create components. You can find entire code here: [Basic Secret Rotation Template Sample](https://github.com/jlichwa/azure-keyvault-basicrotation-tutorial/tree/master/arm-templates).
37
+
38
+
1. Use the Azure Resource Manager template to create components by selecting this link: [Deploy](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fjlichwa%2Fazure-keyvault-basicrotation-tutorial%2Fmaster%2Farm-templates%2Finitial-setup%2Fazuredeploy.json)
39
+
1. For "Resource Group", select "Create New" and give it the name "simplerotation".
40
+
1. Select "Purchase".
41
+
42
+

43
+
44
+
After completing these steps, you will have a key vault, a SQL server, and a SQL database. You can verify this in an Azure CLI terminal by running:
You must now create a Function App with a with system managed identity, as well as the additional required components:
63
+
56
64
Function app requires below components and configuration:
57
65
- App Service Plan
58
66
- Storage Account
59
-
- Function App with System Managed Identity
60
67
- Access policy to access secrets in Key Vault using Function App Managed Identity
61
68
62
-
Azure Resource Manager template to create components:[Deploy](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fjlichwa%2Fazure-keyvault-basicrotation-tutorial%2Fmaster%2Farm-templates%2Ffunction-app%2Fazuredeploy.json)
63
-
- Select resource group like below
64
-
- Click Purchase
69
+
Use the Azure Resource Manager template to create components by selecting this link: [Deploy](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fjlichwa%2Fazure-keyvault-basicrotation-tutorial%2Fmaster%2Farm-templates%2Ffunction-app%2Fazuredeploy.json)
70
+
1. For "Resource Group", select "simplerotation".
71
+
1. Select "Purchase".
65
72
66
-

73
+

74
+
75
+
After completing the steps above, you will have a storage account, a server farm, and a Function App. You can verify this in an Azure CLI terminal by running:
For information how to create Function App and using Managed Identity to access Key Vault, see [Create a function app from the Azure portal](../azure-functions/functions-create-function-app-portal.md) and [Provide Key Vault authentication with a managed identity](managed-identity.md)
0 commit comments