Skip to content

Commit 61017c3

Browse files
Merge pull request #299644 from RoseHJM/mdb-customizations-secrets
MDB - secrets update - it2
2 parents d459db0 + 0762adc commit 61017c3

File tree

1 file changed

+43
-33
lines changed

1 file changed

+43
-33
lines changed
Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,50 @@
11
---
2-
title: Use key vault secrets in customization files
3-
description: Learn how to use Azure Key Vault secrets in team and user customization files to clone private repositories.
2+
title: Fetch Azure Key Vault Secrets from Dev Box Customizations Files
3+
description: Discover how to fetch Azure Key Vault secrets by using team and user customization files to enhance security and simplify workflows.
4+
#customer intent: As a platform engineer, I want to configure Azure Key Vault secrets so that my development teams can securely access private repositories during Dev Box customization.
45
author: RoseHJM
56
ms.author: rosemalcolm
67
ms.service: dev-box
78
ms.custom:
89
- ignite-2024
10+
- ai-gen-docs-bap
11+
- ai-gen-title
12+
- ai-seo-date:05/10/2025
13+
- ai-gen-description
914
ms.topic: how-to
10-
ms.date: 04/20/2025
11-
12-
#customer intent: As a Dev Center Admin or Project Admin, I want to create image definition files so that my development teams can create customized dev boxes.
15+
ms.date: 05/10/2025
1316
---
1417

15-
# Clone a private repository by using a customization file
18+
# Use Azure Key Vault secrets in customization files
1619

1720
[!INCLUDE [note-build-2025](includes/note-build-2025.md)]
1821

1922

20-
You can use secrets from your Azure key vault in your YAML customizations to clone private repositories, or with any custom task you author that requires an access token. In a team customization file, you can use a personal access token (PAT) stored in a key vault to access a private repository.
23+
You can use secrets from your Azure key vault in your YAML customizations to clone private repositories, or with any task you author that requires an access token. For example, in a team customization file, you can use a personal access token (PAT) stored in a key vault to access a private repository.
24+
25+
## Use key vault secrets in customization files
2126

22-
## Use key vault secrets in team customization files
27+
To use a secret, like a PAT, in your customization files, store your PAT as a key vault secret.
2328

24-
To clone a private repository, store your PAT as a key vault secret. See [Grant the managed identity access to the key vault secret](../deployment-environments/how-to-configure-managed-identity.md#grant-the-managed-identity-access-to-the-key-vault-secret), and use it when you invoke the `git-clone` task in your customization.
29+
Both team and user customizations support fetching secrets from a key vault. Team customizations, also known as image definition files, define the base image for the dev box with the `image` parameter, and list the tasks that run when a dev box is created. User customizations list the tasks that run when a dev box is created. The following examples show how to use a key vault secret in both types of customizations.
2530

26-
To configure your key vault secrets for use in your YAML customizations:
31+
To configure key vault secrets for use in your YAML customizations:
2732

2833
1. Ensure that your dev center project's managed identity has the Key Vault Reader role and the Key Vault Secrets User role on your key vault.
2934
2. Grant the Key Vault Secrets User role for the key vault secret to each user or user group that should be able to consume the secret during the customization of a dev box. The user or group granted the role must include the managed identity for the dev center, the admin's user account, and any user or group that needs the secret during dev box customization.
3035

31-
For more information, see:
36+
You can use a key vault secret in-line with the built-in PowerShell task:
3237

33-
- [Configure a managed identity for a dev center](../deployment-environments/how-to-configure-managed-identity.md#configure-a-managed-identity-for-a-dev-center)
34-
- [Grant the managed identity access to the key vault secret](../deployment-environments/how-to-configure-managed-identity.md#grant-the-managed-identity-access-to-the-key-vault-secret)
38+
```yml
39+
$schema: "1.0"
40+
image: microsoftwindowsdesktop_windows-ent-cpc_win11-24H2-ent-cpc
41+
tasks:
42+
- name: git-clone
43+
description: Clone this repository into C:\Workspaces
44+
parameters:
45+
command: MyCommand –MyParam '{{KEY_VAULT_SECRET_URI}}'
46+
```
47+
This example shows an image definition file. The `KEY_VAULT_SECRET_URI` is the URI of the secret in your key vault.
3548

3649
You can reference the secret in your YAML customization in the following format, which uses the `git-clone` task as an example:
3750

@@ -45,37 +58,34 @@ tasks:
4558
directory: C:\Workspaces
4659
pat: '{{KEY_VAULT_SECRET_URI}}'
4760
```
61+
This example shows a user customization file. There is no `image` specified.
4862

49-
## Use key vault secrets in user customization files
50-
51-
To clone a private Azure Repos repository from a user customization file, you don't need to configure a secret in Azure Key Vault. If you want to clone a private Azure Repos repository from a user customization file, you don't need to configure a secret in Azure Key Vault. Instead, you can use `{{ado}}` or `{{ado://your-ado-organization-name}}` as a parameter. This parameter fetches an access token on your behalf when you're creating a dev box. The access token has read-only permission to your repository.
52-
53-
The `git-clone` task in the quickstart catalog uses the access token to clone your repository. Here's an example:
63+
User customizations let you obtain an Azure DevOps token to clone private repositories without explicitly specifying a PAT from the key vault. The service automatically exchanges your Azure token for an Azure DevOps token at run time.
5464

5565
```yml
56-
tasks:
57-
- name: git-clone
58-
description: Clone this repository into C:\Workspaces
59-
parameters:
60-
repositoryUrl: https://myazdo.visualstudio.com/MyProject/_git/myrepo
61-
directory: C:\Workspaces
62-
pat: '{{ado://YOUR_ADO_ORG}}'
63-
```
66+
$schema: "1.0"
67+
tasks:
68+
- name: git-clone
69+
description: Clone this repository into C:\Workspaces
70+
parameters:
71+
repositoryUrl: https://myazdo.visualstudio.com/MyProject/_git/myrepo
72+
directory: C:\Workspaces
73+
pat: '{{ado://YOUR_ORG_NAME}}'
74+
```
6475

65-
The dev center needs access to your key vault. Dev centers don't support service tags, so if your key vault is private, allow trusted Microsoft services to bypass the firewall.
76+
The Dev Box VS Code extension and Dev Box CLI don't support hydrating secrets in the inner-loop testing workflow for customizations.
6677

67-
Dev centers don't support service tags, so if the key vault is private, allow trusted Microsoft services to bypass the firewall.
78+
## Configure key vault access
6879

69-
:::image type="content" source="media/how-to-use-secrets-customization-files/trusted-services-bypass-firewall.png" alt-text="Screenshot that shows the option to allow trusted Microsoft services to bypass the firewall in Azure Key Vault settings." lightbox="media/how-to-use-secrets-customization-files/trusted-services-bypass-firewall.png":::
80+
The dev center needs access to your key vault. Because dev centers don't support service tags, if your key vault is private, let trusted Microsoft services bypass the firewall.
7081

71-
To learn how to allow trusted Microsoft services to bypass the firewall, see [Configure Azure Key Vault networking settings](/azure/key-vault/general/how-to-azure-key-vault-network-security).
82+
:::image type="content" source="media/how-to-use-secrets-customization-files/trusted-services-bypass-firewall.png" alt-text="Screenshot that shows the option to allow trusted Microsoft services to bypass the firewall in Azure Key Vault settings." lightbox="media/how-to-use-secrets-customization-files/trusted-services-bypass-firewall.png":::
7283

73-
## Share a customization file from a code repository
84+
To learn how to let trusted Microsoft services bypass the firewall, see [Configure Azure Key Vault networking settings](/azure/key-vault/general/how-to-azure-key-vault-network-security).
7485

75-
Make the customization file available to dev box pools by naming it *imagedefinition.yaml* and uploading it to the repository that hosts the catalog. When you create a dev box pool, you can select the customization file from the catalog to apply to the dev boxes in the pool.
7686

7787
## Related content
7888

7989
- [Microsoft Dev Box team customizations](concept-what-are-team-customizations.md)
8090
- [Configure imaging for Dev Box team customizations](how-to-configure-customization-imaging.md)
81-
- [Add and configure a catalog from GitHub or Azure Repos](../deployment-environments/how-to-configure-catalog.md)
91+
- Learn how to [add and configure a catalog from GitHub or Azure Repos](../deployment-environments/how-to-configure-catalog.md).

0 commit comments

Comments
 (0)