Skip to content

Instantly share code, notes, and snippets.

@ashtewari
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashtewari/43a3f8cc6e90f2481153 to your computer and use it in GitHub Desktop.
Save ashtewari/43a3f8cc6e90f2481153 to your computer and use it in GitHub Desktop.
## Transfer data in Azure Storage Tables from one Azure Storage Account to another
## Download and install AzCopy -- https://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy/
## Get the Preview version of AzCopy in order to access Table Storage. The current stable version works with Blob storage only.
## Tables will be created if they don't exist
$source_acct = "Source_Azure_Storage_Account_Name"
$source_key="Source_Azure_Storage_Account_Key"
$destination_acct="Destination_Azure_Storage_Account_Name"
$destination_key="Destination_Azure_Storage_Account_Key"
$tables = "Table1","Table2","Table3"
$temp_folder = "C:\temp\ExportedEntities"
foreach ($table in $tables)
{
Start-Process -FilePath "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe" -ArgumentList "/Source:https://$source_acct.table.core.windows.net/$table/ /Dest:$temp_folder /Manifest:$table.manifest /SourceKey:$source_key" -NoNewWindow -Wait
}
foreach ($table in $tables)
{
Start-Process -FilePath "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe" -ArgumentList "/Dest:https://$destination_acct.table.core.windows.net/$table/ /Manifest:$table.manifest /Source:$temp_folder /EntityOperation:InsertOrReplace /DestKey:$destination_key" -NoNewWindow -Wait
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment