Last active
June 7, 2019 14:04
Star
You must be signed in to star a gist
Azure: copy Storage Accounts container
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
#!/usr/bin/env bash | |
# Requires: az-cli, azcopy, jp | |
SOURCE= # Source Storage Account name | |
TARGET= # Target Storage Account name | |
SOURCE_KEY= # Source Storage Account key | |
TARGET_KEY= # Target Storage Account key | |
for CONTAINER in $(az storage container list --account-name ${SOURCE} | jp [].name) | |
do | |
echo "Begin: ${SOURCE}/${CONTAINER}" | |
azcopy \ | |
--source https://${SOURCE}.blob.core.windows.net/${CONTAINER} \ | |
--destination https://${TARGET}.blob.core.windows.net/${CONTAINER} \ | |
--source-key ${SOURCE_KEY} \ | |
--dest-key ${TARGET_KEY} \ | |
--recursive \ | |
--sync-copy | |
echo "End: ${SOURCE}/${CONTAINER}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment