Hi all,
I'm trying to use a medialink property from a get-AzureOSDisk to put into a Start-AzureStorageBlobCopy, but the -srcUri field isn't accepting it since the medialink uri includes in it the port.
the get-azureOSDisk.medialink uri looks like this(sorry for the weird URL - I cannot post links since my account isnt verified):
httpsWACKWACKmystaccount.blobDOTcoreDOTwindowsDOTnet:
8080/vhds/diskname.vhd
While the -srcUri field in Start-AzureStorageBlobCopy will only accept: "httpsWACKWACKmystaccountDOTblobDOTcoreDOTwindowsDOTnet/vhds/diskname.vhd"
I'm trying to write a script to regulate those kinds of copies, so I can just get the URL and change it manually.
Any thoughts?
Thanks.
P.S.: My PS Script so far(when I use it this way, I'm getting an error: "Start-AzureStorageBlobCopy : The underlying connection was closed: An unexpected error occurred on a send.". The error doesnt occur if I remove the port from the URI)
#azure subscription ID
$subid="subscription id"
#Names of the storage accounts
$SourceAccount="source account"
$DestAccount="dest account"
#cloud service and name Of the VM to copy and destroy
$VMname="vm name"
$CSname="cs name"
select-AzureSubscription -Subscriptionid $subid
#Get the primary access keys of the storage accounts and put them in $sourcekey and $destkey
$sourcekey=Get-azurestoragekey -StorageAccountName $SourceAccount
$sourcekey=$sourcekey.Primary
$Destkey=Get-azurestoragekey -StorageAccountName $DestAccount
$Destkey=$Destkey.Primary
#Create contexts for both storageaccounts
$sourceContext = New-AzureStorageContext –StorageAccountName $SourceAccount -StorageAccountKey $sourcekey
$destContext = New-AzureStorageContext –StorageAccountName $DestAccount -StorageAccountKey $Destkey
#Create a new container in the destination container
New-AzureStorageContainer -Name "$($vmname)-vhds" -Context $destContext
#Get the OS disk properties and copy it
$OSDisk=get-azurevm -servicename $CSname -name $VMname | Get-azureosdisk
$sourceBlobUri = $OSDisk.medialink
Start-AzureStorageBlobCopy -srcUri $sourceBlobUri -SrcContext $sourceContext -DestContainer "$($vmname)-vhds" -DestBlob "$($osdisk.DiskName).vhd" -DestContext $destContext