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
+19-14Lines changed: 19 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,36 +82,37 @@ The dev center needs access to your key vault. Because dev centers don't support
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
85
+
## Authenticate to Azure resources with service principals
86
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.
87
+
You can use service principals to authenticate to Azure resources in your customizations. Service principals are a secure way to access Azure resources without using user credentials.
88
88
89
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
90
91
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
92
93
-
```azurecli
93
+
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.
94
+
95
+
```azurecli
94
96
$ az ad sp create-for-rbac -n DevBoxCustomizationsTest
95
97
96
98
{
97
-
"appId": "...",
98
-
"displayName": "DevBoxCustomizationsTest",
99
-
"password": "...",
100
-
"tenant": "..."
99
+
"appId": "...",
100
+
"displayName": "DevBoxCustomizationsTest",
101
+
"password": "...",
102
+
"tenant": "..."
101
103
}
102
-
```
104
+
```
103
105
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
106
-
Store the password returned above in a Key Vault secret, e.g.
107
+
2. Store the password returned above in a Key Vault secret, like this: `https://mykeyvault.vault.azure.net/secrets/password`
3. On the Key Vault, grant the *Key Vault Secrets User* role to the project identity.
109
110
110
-
On the Key Vault, grant the "Key Vault Secrets User" role to the project identity
111
+
Now you can authenticate in customization tasks, hydrating the service principal password from the Key Vault at customization time.
111
112
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
+
### Example: Download a file from Azure Storage
113
114
114
-
The following YAML snippet defines a Dev Box customization that performs two main tasks:
115
+
The following example shows you how to download a file from storage account. The YAML snippet defines a Dev Box customization that performs two main tasks:
115
116
116
117
1. Installs the Azure CLI using the winget package manager.
117
118
1. Runs a PowerShell script that:
@@ -142,6 +143,10 @@ tasks:
142
143
143
144
This setup allows automated, secure access to Azure resources during Dev Box provisioning, without exposing credentials in the script.
144
145
146
+
### Example: Download an artifact from Azure DevOps
147
+
148
+
Downloading a build artifact from ADO is similarly possible. Instead of making a role assignment to the SP, it needs to be added as a user to the ADO organization...
149
+
145
150
## Related content
146
151
147
152
-[Microsoft Dev Box customizations](concept-what-are-dev-box-customizations.md)
0 commit comments