Skip to content

Commit 4557107

Browse files
Merge pull request #53511 from JeffKoMS/manage-app-secrets-key-vault
Added files for new module on AKV
2 parents 14116fe + 0d7c9d9 commit 4557107

17 files changed

Lines changed: 738 additions & 0 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.manage-app-secrets-key-vault.introduction
3+
title: Introduction
4+
metadata:
5+
title: Introduction
6+
description: Introduction
7+
ms.date: 02/17/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 3
12+
content: |
13+
[!include[](includes/1-introduction.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.manage-app-secrets-key-vault.store-organize-secrets
3+
title: Store and organize secrets, keys, and certificates
4+
metadata:
5+
title: Store and Organize Secrets, Keys, and Certificates
6+
description: Store and organize secrets, keys, and certificates
7+
ms.date: 02/17/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 10
12+
content: |
13+
[!include[](includes/2-store-organize-secrets.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.manage-app-secrets-key-vault.retrieve-secrets-sdk
3+
title: Retrieve secrets using Azure SDK client libraries
4+
metadata:
5+
title: Retrieve Secrets Using Azure SDK Client Libraries
6+
description: Retrieve secrets using Azure SDK client libraries
7+
ms.date: 02/17/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 10
12+
content: |
13+
[!include[](includes/3-retrieve-secrets-sdk.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.manage-app-secrets-key-vault.handle-versioning-rotation
3+
title: Handle secret versioning and rotation
4+
metadata:
5+
title: Handle Secret Versioning and Rotation
6+
description: Handle secret versioning and rotation
7+
ms.date: 02/17/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 12
12+
content: |
13+
[!include[](includes/4-handle-versioning-rotation.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.manage-app-secrets-key-vault.implement-caching-strategies
3+
title: Implement caching strategies to reduce Key Vault calls
4+
metadata:
5+
title: Implement Caching Strategies to Reduce Key Vault Calls
6+
description: Implement caching strategies to reduce Key Vault calls
7+
ms.date: 02/17/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 12
12+
content: |
13+
[!include[](includes/5-implement-caching-strategies.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.manage-app-secrets-key-vault.exercise-manage-secrets
3+
title: Exercise - Manage secrets with Azure Key Vault
4+
metadata:
5+
title: Exercise - Manage Secrets with Azure Key Vault
6+
description: Exercise - Manage secrets with Azure Key Vault
7+
ms.date: 02/17/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 20
12+
content: |
13+
[!include[](includes/6-exercise-manage-secrets.md)]
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.manage-app-secrets-key-vault.knowledge-check
3+
title: Module assessment
4+
metadata:
5+
title: Module Assessment
6+
description: Module assessment
7+
ms.date: 02/17/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 5
12+
content: "Choose the best response for each of the following questions."
13+
quiz:
14+
questions:
15+
- content: "Your AI application needs to read secrets from Azure Key Vault at runtime but shouldn't be able to create or delete secrets. Which built-in RBAC role should you assign to the application's managed identity?"
16+
choices:
17+
- content: "Key Vault Secrets User"
18+
isCorrect: true
19+
explanation: "Key Vault Secrets User grants read-only access to secret values, which is the appropriate least-privilege role for applications that retrieve but don't manage secrets."
20+
- content: "Key Vault Secrets Officer"
21+
isCorrect: false
22+
explanation: "Key Vault Secrets Officer grants full management permissions including create, update, and delete operations. This exceeds the permissions needed for an application that only reads secrets at runtime."
23+
- content: "Key Vault Contributor"
24+
isCorrect: false
25+
explanation: "Key Vault Contributor is a control plane role that manages the vault resource itself, such as creating or deleting vaults. It doesn't grant access to data plane operations like reading secret values."
26+
- content: "You want your application to authenticate with Key Vault using managed identity in production and Azure CLI credentials during local development, without changing code between environments. Which credential class should you use?"
27+
choices:
28+
- content: "ManagedIdentityCredential"
29+
isCorrect: false
30+
explanation: "ManagedIdentityCredential only works with managed identities on Azure compute resources. It fails in local development environments where no managed identity is available, so you'd need to change code between environments."
31+
- content: "EnvironmentCredential"
32+
isCorrect: false
33+
explanation: "EnvironmentCredential reads service principal credentials from environment variables. It requires you to set and manage client secret values, which contradicts the goal of credential-free authentication with managed identity."
34+
- content: "DefaultAzureCredential"
35+
isCorrect: true
36+
explanation: "DefaultAzureCredential chains multiple authentication methods in a defined order, automatically using managed identity on Azure compute resources and Azure CLI credentials in local development environments."
37+
- content: "You store three versions of a secret named 'cosmosdb-connection-string' in Key Vault. What does calling get_secret('cosmosdb-connection-string') without a version parameter return?"
38+
choices:
39+
- content: "The first version that was created"
40+
isCorrect: false
41+
explanation: "Key Vault returns the latest enabled version, not the original version. The first version is only returned if you specify its version identifier explicitly in the get_secret() call."
42+
- content: "The latest enabled version of the secret"
43+
isCorrect: true
44+
explanation: "When no version parameter is specified, get_secret() always returns the most recent enabled version of the secret. This behavior is what enables rotation by simply storing a new version."
45+
- content: "All three versions as a list of KeyVaultSecret objects"
46+
isCorrect: false
47+
explanation: "get_secret() returns a single KeyVaultSecret object for one version. To enumerate all versions, you use the list_properties_of_secret_versions() method instead."
48+
- content: "Your AI application connects to a service that supports two active keys simultaneously. You need to rotate the credential without any application downtime. Which rotation strategy should you use?"
49+
choices:
50+
- content: "Dual-credential rotation"
51+
isCorrect: true
52+
explanation: "Dual-credential rotation generates a new secondary key, stores it in Key Vault, waits for all application instances to pick up the new value, then regenerates the old key. At least one valid credential always exists, preventing downtime."
53+
- content: "Manual rotation with application restart"
54+
isCorrect: false
55+
explanation: "Manual rotation with a restart creates a downtime window during the restart process. It doesn't take advantage of the two-key model that the target service supports."
56+
- content: "Automated rotation with Event Grid only"
57+
isCorrect: false
58+
explanation: "Event Grid automation triggers rotation based on expiry events but doesn't inherently use the two-key model. Dual-credential rotation is designed for services that support two active keys simultaneously."
59+
- content: "Your AI inference service processes 500 requests per second and retrieves an API key from Key Vault for each request. The API key rotates every 90 days. What caching approach best balances performance with security?"
60+
choices:
61+
- content: "No caching with direct Key Vault calls per request"
62+
isCorrect: false
63+
explanation: "At 500 requests per second, direct vault calls exceed Key Vault's throttling limit of 4,000 GET transactions per ten-second window, resulting in HTTP 429 responses and degraded performance."
64+
- content: "Time-based in-memory cache with a one-hour TTL"
65+
isCorrect: true
66+
explanation: "A one-hour staleness window is small relative to a ninety-day rotation cycle, eliminates redundant vault calls, and keeps the application well within Key Vault's throttling limits."
67+
- content: "Startup preloading with no periodic refresh"
68+
isCorrect: false
69+
explanation: "Startup preloading without periodic refresh means the application uses the same credential for its entire lifetime. If a rotation occurs while the application is running, it never picks up the new credential. A time-based refresh ensures the application eventually retrieves updated values."
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.manage-app-secrets-key-vault.summary
3+
title: Summary
4+
metadata:
5+
title: Summary
6+
description: Summary
7+
ms.date: 02/17/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 2
12+
content: |
13+
[!include[](includes/8-summary.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
AI applications require secure, centralized credential management to protect API keys, connection strings, and encryption keys across development, staging, and production environments. This module guides you through using Azure Key Vault to store, retrieve, and manage secrets in AI solutions on Azure.
2+
3+
Imagine you're a developer building a RAG pipeline that connects to multiple backend services. The pipeline calls an Azure OpenAI endpoint for embeddings generation, reads from an Azure Cosmos DB vector store, and writes processed results to Azure Blob Storage. Each service requires its own credentials, and those credentials differ across development, staging, and production environments. Today, the team stores connection strings in environment variables and configuration files checked into source control. A recent security audit flagged this practice as a risk because credentials are visible to anyone with repository access, and rotating a compromised key requires redeploying every service that uses it. The client expects credential rotation within four hours of a suspected compromise, with zero downtime during the rotation window. Your team needs a centralized secrets store that controls access through identity-based permissions, tracks every secret access in audit logs, and supports versioned secrets so applications can transition to new credentials without interruption. Caching secrets locally also matters because the pipeline processes thousands of documents per hour, and calling a remote vault for every operation adds unacceptable latency. Azure Key Vault provides the secure storage, versioning, rotation support, and SDK integration that this architecture requires.
4+
5+
After completing this module, you'll be able to:
6+
7+
- Explain how Azure Key Vault stores and organizes secrets, keys, and certificates, and identify when to use each object type in an AI solution.
8+
- Retrieve secrets programmatically using Azure SDK client libraries with managed identity authentication.
9+
- Handle secret versioning and rotation in application code to support zero-downtime credential updates.
10+
- Implement caching strategies that reduce Key Vault API calls while maintaining security and freshness guarantees.
11+
12+
> [!NOTE]
13+
> All code examples in this module are based on the most recent version of the `azure-keyvault-secrets` library at the time of writing. The library is updated often and the recommendation is to visit the [Azure Key Vault secrets client library for Python](/python/api/overview/azure/keyvault-secrets-readme) for the most up-to-date information.

0 commit comments

Comments
 (0)