Move an Azure storage blob to another store

Audience

Everyone

Move an Azure storage blob to another store took a little bit longer than I thought that it would. All I wanted to do was move a VHD from one storage account to another. However this is a little more complicated than it seems on the surface.

I am working on teaching the Managing Projects with Microsoft Visual Studio Team Foundation Server 2013 course in Cheltenham this week and have been creating training virtual machines in Azure. My template is 80GB and it is quite an arduous task to upload it. I now want to move it to a new, less temporary, home.

clip_image001

I want to move my training VM from the “trainingeu” storage account to the “almtrainingvm” one. This is really just a refactor now that I have everything working and have thought about a new home. The copy process however is a little bit convoluted, especially as both containers are marked as private.

What I really want to be able to do is just call “Copy-AzureStorageBlob -source https://trainingeu.blob.core.windows.net/vhds/bkvm-2013-3.vhd -destination https://almtrainingvm.blob.core.windows.net/vhds/bkvm-2013-3.vhd” and be done with it. But alas… this is not to be as we need to authenticate to both storage accounts separately even though we are authenticated against the main account.

So… we need a little more PowerShell than I wanted:

Select-AzureSubscription "Pay-As-You-Go"

### Source VHD

$sourceUri = "https://trainingeu.blob.core.windows.net/vhds/bkvm-2013-3.vhd"

$sourceStorageAccount = "trainingeu"

$sourceStorageKey = "bla"

$sourceContext = New-AzureStorageContext –StorageAccountName $srcStorageAccount `

-StorageAccountKey $srcStorageKey

### Target VHD

$targetName = "bkvm-2013-3.vhd"

$targetStorageAccount = "almtrainingvm"

$targetStorageKey = "bla"

$targetContainerName = "vhds"

$targetContext = New-AzureStorageContext –StorageAccountName $targetStorageAccount `

-StorageAccountKey $targetStorageKey

$blob1 = Start-AzureStorageBlobCopy -srcUri $sourceUri -SrcContext $sourceContext -DestContainer $targetContainerName -DestBlob $targetName -DestContext $targetContext

 

clip_image002

Why we can’t do this with URL’s and an authenticated account I do not know… but this is what we got and we have to roll with it.

clip_image003

Now that I have my VHD over here I can change my default store and create my Virtual Machines from this VHD instead of the other one. Not the easiest task, but now I have some lovely PowerShell I should be able to move VHD’s between Azure Storage Accounts any time I like.

Upcoming Training Opportunities

These are the next five classes we have, and you can check out our full public schedule of classes.

Timezone:
Live Virtual Product Backlog Management Skills with Joanna on 14th December 2023
Virtual Traditional
14-15 Dec, 2023
09:00-13:00 CET
2 half-days
Immersive Professional Agile Leadership Essentials with Joanna on 12th January 2024
Virtual Immersive
12 Jan-1 Jan, 2024
13:00-17:00 GMT
8 weekly half-days
Immersive Professional Scrum Product Owner with Martin on 17th January 2024
Virtual Immersive
17 Jan-6 Jan, 2024
13:00-17:00 GMT
8 weekly half-days
Immersive Professional Scrum Master (PSM) with Dan on 17th January 2024
Virtual Immersive
17 Jan-28 Jan, 2024
13:00-17:00 GMT
7 weekly half-days

We can deliver any of our courses as private in-house training over Microsoft Teams & Mural. We also recommend training based on your accountabilities or role, you can go directly to recommended courses for Scrum MastersProduct OwnersDevelopers and Agile Leaders.

Create a conversation around this article

Share on Facebook
Share on Twitter
Share on Linkdin

Related Courses

No items found

Read more

Martin Hinshelwood NKDAgility.com
https://youtube.com/shorts/Ce5pFwG5IAY Scrum Masters: Unlocking the Power of Liberating Structures 🚀  In the dynamic world of Agile and Scrum, Scrum Masters are continuously seeking innovative ways to enhance collaboration and effectiveness within their teams.  Introduction: Embracing Liberating Structures in Scrum  One transformative approach that’s gaining traction is the use of liberating …
Martin Hinshelwood NKDAgility.com
Business Leaders face a key challenge when scaling their organisations effectively while maintaining the distinctiveness that made us successful in the first place. Many frameworks and methodologies, such as Scaled Agile Framework (SAFe) or the Spotify Model, promise a structured approach to scaling, but do they genuinely fit our unique …
Martin Hinshelwood NKDAgility.com
As we inch further into the dynamic landscape of the 21st century, our long-established Alpha organisations stand on shaky ground. The organisations whose DNA is infused with strict command and control, woven into the fabric of every process, are feeling the tremors of a rapidly evolving, technologically charged market. Not …
Martin Hinshelwood NKDAgility.com
Under the ruthless canopy of the red market, I find myself staring at the bloated behemoth of an Alpha organisation, huffing and puffing in a vain attempt to keep up with the frenzied pace of the modern world. The Alpha model, once a paragon of order and efficiency in the …

OUR TEAM

We believe that every company deserves high quality software delivered on a regular cadence that meets its customers needs. Our goal is to help you reduce your cycle time, improve your time to market, and minimise any organisational friction in achieving your goals.

naked Agility Limited is a professional company that offers training, coaching, mentoring, and facilitation to help people and teams evolve, integrate, and continuously improve.

We recognise the positive impact that a happy AND motivated workforce, that has purpose, has on client experience. We help change mindsets towards a people-first culture where everyone encourages others to learn and grow. The resulting divergent thinking leads to many different ideas and opportunities for the success of the organisation.