I had a script I have used many time to duplicate a disk by copying the blob then attaching the disk. It has recently started to fail with the error message:
Update-AzureVM : BadRequest: The specified disk size value of 0 GB is invalid. Disk size must be between 1 GB and 1023 GB.
At line:1 char:171
+ ... Caching None | Update-AzureVM
+ ~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Update-AzureVM], CloudException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.UpdateAzureVMCommand
The script is:
$storageAccount = Get-AzureStorageAccount
$storageKey = Get-AzureStorageKey -StorageAccountName $storageAccount.Label
$destContext = New-AzureStorageContext -StorageAccountName $storageAccount.Label -StorageAccountKey $storageKey.Primary
$srcUri = "http://myaccount.blob.core.windows.net/vhds/TestDisk.vhd"
$fileName = "NewTestDisk.vhd"
$blob = Start-AzureStorageBlobCopy -srcUri $srcUri -DestContainer $containerName -DestBlob $fileName -DestContext $destContext
$CopyState = Get-AzureStorageBlobCopyState -Container $containerName -Blob $blob.Name
While ($CopyState.Status -ne "Success")
{
Start-Sleep 15
}
$uri = "http://myaccount.blob.core.windows.net/vhds/NewTestDisk.vhd"
$AddDiskStatus = Get-AzureVM -ServiceName $serviceName -Name $vmName | Add-AzureDataDisk -ImportFrom -MediaLocation $uri -DiskLabel $disklabel -LUN 0 -HostCaching None | Update-AzureVM
The blob copies you can see it in storage. In fact, once you get the error you can go into the web GUI and Attach the disk.
Anyone seen this? I know many people use similar to copy blobs across accounts, this is even simpler its in the same account in the same storage and location.Any thoughts would be appreciated.