Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save caveatlector/d02ce1cee83aa8ce2c92386bcee300da to your computer and use it in GitHub Desktop.
Azure: copy Storage Accounts container
#!/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