Skip to content

Commit 7d7f17e

Browse files
author
RoseHJM
committed
WIP
1 parent 1a52ad8 commit 7d7f17e

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

articles/dev-box/how-to-customizations-connect-resource-repository.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,36 +82,37 @@ The dev center needs access to your key vault. Because dev centers don't support
8282

8383
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).
8484

85-
## Authenticate with service principals
85+
## Authenticate to Azure resources with service principals
8686

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.
8888

8989
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.
9090

9191
1. Create a service principal in Azure Active Directory (Azure AD) and assign it the necessary roles for the resources you want to access.
9292

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
9496
$ az ad sp create-for-rbac -n DevBoxCustomizationsTest
9597
9698
{
97-
  "appId": "...",
98-
  "displayName": "DevBoxCustomizationsTest",
99-
  "password": "...",
100-
  "tenant": "..."
99+
"appId": "...",
100+
"displayName": "DevBoxCustomizationsTest",
101+
"password": "...",
102+
"tenant": "..."
101103
}
102-
```
104+
```
103105

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.
105106

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`
107108

108-
https://mykeyvault.vault.azure.net/secrets/password
109+
3. On the Key Vault, grant the *Key Vault Secrets User* role to the project identity.
109110

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.
111112

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
113114

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:
115116

116117
1. Installs the Azure CLI using the winget package manager.
117118
1. Runs a PowerShell script that:
@@ -142,6 +143,10 @@ tasks:
142143

143144
This setup allows automated, secure access to Azure resources during Dev Box provisioning, without exposing credentials in the script.
144145

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+
145150
## Related content
146151

147152
- [Microsoft Dev Box customizations](concept-what-are-dev-box-customizations.md)

0 commit comments

Comments
 (0)