Hi,
I have an Azure deployment template that creates a VM and joins it to a domain. The password (domainJoinUserPassword) of the user that has the rights to add a machine to a domain is stored in a key vault. The deployment works perfectly fine when parameters are defined in a JSON file (the key vault reference included). New-AzureRmResourceGroupDeployment commandlet is invoked with TemplateParameterFile parameter.
However, when I have modified the script to use hash table with parameter to be provided as a value of
TemplateParameterObject parameter, I am getting the following error
The provided value for the template parameter 'domainJoinUserPassword' at line '71' and column '36' is not valid.'
The hash table looks like this:
$parameters = @{
...
domainJoinUserPassword = @{
reference = @{
keyVault = @{
id = "/subscriptions/id/resourceGroups/Infra/providers/Microsoft.KeyVault/vaults/VaultName"
}
secretName = "MySecret"
}
}
How can I reference the key vault secret in the hash table? Or is this not the right approach and I should stick with the JSON file?
Thanks, Karel
Hi,
I have an Azure deployment template that creates a VM and joins it to a domain. The password (
domainJoinUserPassword) of the user that has the rights to add a machine to a domain is stored in a key vault. The deployment works perfectly fine when parameters are defined in a JSON file (the key vault reference included).New-AzureRmResourceGroupDeploymentcommandlet is invoked withTemplateParameterFileparameter.However, when I have modified the script to use hash table with parameter to be provided as a value of
TemplateParameterObjectparameter, I am getting the following errorThe hash table looks like this:
How can I reference the key vault secret in the hash table? Or is this not the right approach and I should stick with the JSON file?
Thanks, Karel