locked
Copying all containers inside storage RRS feed

  • Question

  • Following command copy container from one storage account to another cross subscription.

    AzCopy /Source:https://sourceaccount.blob.core.windows.net/mycontainer1
    /Dest:https://destaccount.blob.core.windows.net/mycontainer2 /SourceKey:key1 /DestKey:key2 /S

    We have more then 100 containers and increasing day by day. Is there any script that can copy and paste all storage containers in other storage account?

    Saturday, October 28, 2017 1:50 AM

Answers

All replies

  • You may refer “How to copy all containers along with blobs from one storage account to other storage account”, which addressing your query.

    ----------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Saturday, October 28, 2017 4:49 AM
  • Wonderful Pradeep.. Yes its working...thanks :)
    Saturday, October 28, 2017 8:12 AM
  • Glad to hear that your issue has been resolved.

    -----------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Saturday, October 28, 2017 8:17 AM
  • Hi Pardeep,

    Script is i believe in calssic mode instead of ARM. It getting failed when i m trying to configure in Azure Webjob. Any advise.

    Saturday, October 28, 2017 8:58 AM
  • I suggest you to verify the PS Version and update commands: 

    https://docs.microsoft.com/en-us/powershell/module/azure.storage/get-azurestorageblob?view=azurermps-4.4.1

    Create Storage Account: 

    $StorageAccount = @{
        ResourceGroupName = 'ArtofShell';
        Name = 'artofshellstorage';
        SkuName = 'Standard_LRS';
        Location = 'West Europe';
        }
    New-AzureRmStorageAccount @StorageAccount;

    Authenticate to Blob Storage: 

    ### Obtain the Storage Account authentication keys using Azure Resource Manager (ARM)
    $Keys = Get-AzureRmStorageAccountKey -ResourceGroupName ArtofShell -Name artofshellstorage;
    
    ### Use the Azure.Storage module to create a Storage Authentication Context
    $StorageContext = New-AzureStorageContext -StorageAccountName ArtofShell -StorageAccountKey $Keys[0].Value;

    Create Blob: 

    ### Create a Blob Container in the Storage Account
    New-AzureStorageContainer -Context $StorageContext -Name uploads;

    Upload Blob:

    ### Upload a file to the Microsoft Azure Storage Blob Container
    $UploadFile = @{
        Context = $StorageContext;
        Container = 'uploads';
        File = "$env:WinDir\notepad.exe";
        }
    Set-AzureStorageBlobContent @UploadFile;

    On the other hand: "We have more then 100 containers and increasing day by day. "

    I would strongly recommend you to check this this project tracks Kubernetes cluster upgrade feature using node replace method (replace existing nodes with new upgrades nodes) with more features to come.

    https://github.com/Azure/acs-engine/projects

    My .2 cents!


    David Rendón @DaveRndn

    Monday, October 30, 2017 11:25 PM