[英]Store multiple secrets in Keyvault with one Azure Cli command
Sorry, Noobie here.抱歉,这里是 Noobie。 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.
也许这是一个非常简单明了的答案,但我正在尝试存储大量的 keyvault 秘密,并且正在寻找一种与一次输入每个秘密相比更简单的方法来做到这一点。 I figure using the CLI would be a quicker way to get this done than the Azure Resource Manager interface.
我认为使用 CLI 比 Azure 资源管理器界面更快捷。
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如果“ARM 接口”是指模板,那么已经为这种情况编写了一个模板: https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.keyvault/key-vault -秘密创建
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.不知道这是否真的对任何人有帮助,因为它太基础了,但我最终在 bash 中创建了一个 for 循环脚本,它将输入文件作为变量并动态创建 keyvault 并使用基于 values.txt 的值填充所述 keyvault名称。
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.