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/azure-developer-cli/manage-environment-variables.md
+8-25Lines changed: 8 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -208,39 +208,22 @@ This pattern keeps your templates flexible, enables per-environment customizatio
208
208
209
209
### Hooks
210
210
211
-
In custom scripts and [hooks](azd-extensibility.md) defined in your `azure.yaml` file, you can access environment variables using the `azd env get-values` command:
211
+
`azd` environment variables are automatically preloaded and available in [hooks](azd-extensibility.md) and custom scripts defined in your `azure.yaml` file, you can access environment variables using the following syntax:
212
212
213
213
### [Bash](#tab/bash)
214
214
215
215
```bash
216
-
#!/bin/bash
217
-
echo "Loading azd .env file from current environment..."
218
-
219
-
while IFS='=' read -r key value; do
220
-
value=$(echo "$value" | sed 's/^"//' | sed 's/"$//')
221
-
export "$key=$value"
222
-
done <<EOF
223
-
$(azd env get-values)
224
-
EOF
225
-
226
-
# Now you can use the variables like regular environment variables
216
+
# Use the variables in your script
227
217
echo "API endpoint: $API_ENDPOINT"
218
+
echo "Deploying to: $AZURE_LOCATION"
228
219
```
229
220
230
221
### [PowerShell](#tab/powershell)
231
222
232
223
```powershell
233
-
Write-Host "Loading azd .env file from current environment"
0 commit comments