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/dev-box/how-to-customizations-connect-resource-repository.md
+61-2Lines changed: 61 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ ms.custom:
12
12
- ai-seo-date:05/10/2025
13
13
- ai-gen-description
14
14
ms.topic: how-to
15
-
ms.date: 05/10/2025
15
+
ms.date: 07/18/2025
16
16
---
17
17
18
18
# Connect to Azure resources or clone private repositories by using customizations
@@ -74,14 +74,73 @@ tasks:
74
74
75
75
The Dev Box VS Code extension and Dev Box CLI don't support hydrating secrets in the inner-loop testing workflow for customizations.
76
76
77
-
## Configure key vault access
77
+
### Configure key vault access
78
78
79
79
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.
80
80
81
81
:::image type="content" source="media/how-to-customizations-connect-resource-repository/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-customizations-connect-resource-repository/trusted-services-bypass-firewall.png":::
82
82
83
83
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).
84
84
85
+
## Authenticate with service principals
86
+
87
+
You can use service principals to authenticate with Azure resources in your customizations. Service principals are a secure way to access Azure resources without using user credentials.
88
+
89
+
Create a Service Principal with required role assignments, and use it to log in in a customizations tasks, hydrating its credentials at customization time using the existing secrets feature. The next section provides the necessary steps.
90
+
91
+
1. Create a service principal in Azure Active Directory (Azure AD) and assign it the necessary roles for the resources you want to access.
92
+
93
+
```azurecli
94
+
$ az ad sp create-for-rbac -n DevBoxCustomizationsTest
95
+
96
+
{
97
+
"appId": "...",
98
+
"displayName": "DevBoxCustomizationsTest",
99
+
"password": "...",
100
+
"tenant": "..."
101
+
}
102
+
```
103
+
104
+
The output is a JSON object containing the service principal's appId, displayName, password, and tenant, which are used for authentication and authorization in Azure automation scenarios.
105
+
106
+
Store the password returned above in a Key Vault secret, e.g.
On the Key Vault, grant the "Key Vault Secrets User" role to the project identity
111
+
112
+
Now you can authenticate in customization tasks, hydrating the service principal password from the Key Vault at customization time. E.g. to download a file from storage account:
113
+
114
+
The following YAML snippet defines a Dev Box customization that performs two main tasks:
115
+
116
+
1. Installs the Azure CLI using the winget package manager.
117
+
1. Runs a PowerShell script that:
118
+
- Logs in to Azure using a service principal, with the password securely retrieved from Azure Key Vault.
119
+
- Downloads a blob (file) from an Azure Storage account using the authenticated session.
0 commit comments