Last active
October 10, 2019 10:05
-
-
Save timja/e02976ff0dbb696caea605f08dce9597 to your computer and use it in GitHub Desktop.
dump and copy to new keyvault
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
old_vault_name=$1 | |
new_vault_name=$2 | |
for file in $old_vault_name/* | |
do | |
echo $file | cut -d '/' -f 2 | xargs -n1 -I % sh -c 'az keyvault secret set --vault-name '${new_vault_name}' --name '%' --value $(cat '$file')' | |
done | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
vault_name=$1 | |
mkdir -p ${vault_name} | |
az keyvault secret list --vault-name ${vault_name} -o tsv --query [].id | cut -d '/' -f 5 | xargs -n1 -I % sh -c "az keyvault secret show --vault-name ${vault_name} --name % -o tsv --query value > ${vault_name}/%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment