Howto secure a string or a object inside an array of objects parameter file #4161
-
I deploy severale alert action groups with a bicep module. I run a for loop over an array of objects to deploy the alert groups. Is there a way to do this with azure key vault or via bicep?
Thanks for your time. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The only way to secure strings is via the secure string parameter, in which case it can be pulled from a keyvault.
@secure()
param serviceURI1 string unless you are able to read it from somewhere in Azure via listkeys etc. below is a sample of one way to achieve this via a secret lookup. You will need to pre-create the secret values in the KV. var actionGroups = [
{
'name': 'AG01'
'secretName': 'webHook1'
}
]
var kvName = 'mykv1'
resource KV 'Microsoft.KeyVault/vaults@2021-06-01-preview' existing = {
name: kvName
}
module actionGroup 'actionGroup.bicep' = [ for (ag,index) in actionGroups : {
name: 'dp-ag-${ag.name}'
params: {
serviceURI1: KV.getSecret(ag.secretName)
actionGroup: ag
}
}] |
Beta Was this translation helpful? Give feedback.
The only way to secure strings is via the secure string parameter, in which case it can be pulled from a keyvault.
unless you are able to read it from somewhere in Azure via listkeys etc.
below is a sample of one way to achieve this via a secret lookup. You will need to pre-create the secret values in the KV.