Skip to content

Commit d19f396

Browse files
author
manualbashing
committed
add loop to secrets post
1 parent 07a9f67 commit d19f396

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

content/en/posts/Keep-your-secrets-out-of-your-bicep-parameters.md

+14
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,20 @@ resource keyvaultSecretFishfun 'Microsoft.KeyVault/vaults/secrets@2019-09-01' =
113113
}
114114
```
115115

116+
## Use a loop to deploy the secrets
117+
118+
If you happen to have a lot of secrets that you want to deploy this way, or if you want to make sure that new secrets can be added without touching the deployment code, you can use a loop to iterate over the properties of the `keyvaultSecrets' object.
119+
120+
```json
121+
resource secret 'Microsoft.KeyVault/vaults/secrets@2019-09-01' = [for secretItem in items(keyvaultSecrets): {
122+
parent: keyVault
123+
name: secretItem.key
124+
properties: {
125+
value: secretItem.value
126+
}
127+
}]
128+
```
129+
116130
## Protect your local secret files
117131

118132
So far we have managed to keep our secrets out of version control, but they are still laying around in plain text files, which is not what we want for any type of secret.

0 commit comments

Comments
 (0)