Last active
October 13, 2020 20:12
-
-
Save rproenca/e80529eb8301a69ec140a678a25fc5f3 to your computer and use it in GitHub Desktop.
A bash script that updates Azure Vault network ACLs given list of CIDRs addresses
This file contains hidden or 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 | |
# This script updates Azure Vault network ACLs given list of IP Addresses in CIDR format | |
VAULT_NAME=$1; # Vault name | |
INPUT_FILENAME=cidr_list.txt | |
if [ -z $VAULT_NAME ] | |
then | |
printf "Incorrect usage. Please use: ./update.sh [vault_name]\n"; | |
printf "Example: ./update.sh my-vault-tst\n"; | |
else | |
IFS=$'\n' read -d '' -r -a cidr_list < $INPUT_FILENAME | |
for i in "${!cidr_list[@]}" | |
do | |
# Add a network rule to the network ACLs for a Key Vault | |
az keyvault network-rule add -n $VAULT_NAME --ip-address ${cidr_list[i]} | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment