Sorry, Noobie here. Perhaps it is a very easy and obvious answer but I am trying to store an extensive list of keyvault secrets and am looking for an easy-ish way to do it compared with entering each one at a time. I figure using the CLI would be a quicker way to get this done than the Azure Resource Manager interface.
CodePudding user response:
If by "ARM Interface" you mean a template, there is a template already written for this case: https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.keyvault/key-vault-secret-create
CodePudding user response:
Don't know if this will actually help anyone because its so basic but I ended up creating a for loop script in bash that takes the input files as variables and dynamically creates the keyvault and populates said keyvault with the values based on the values.txt name.
running:
bash keyvault_creator.sh key.txt vault1.txt
runs:
#!/bin/bash
key=$1
value=$2
az keyvault create --location <location> --name "${value%.*}" --resource-group <ResourceGroupName>
paste $key $value | while read if of; do
echo "$if" "$of"
az keyvault secret set --vault-name "${value%.*}" --name "$if" --value "$of"
done