Question:
In powershell I verify that it exists by calling the context.
1 2 |
New-AzureStorageContext -StorageAccountName "testdisks401" -StorageAccountKey "...." |
Result
1 2 3 4 5 6 7 8 9 10 11 |
StorageAccountName : testdisks401 BlobEndPoint : https://testdisks401.blob.core.windows.net/ TableEndPoint : https://testdisks401.table.core.windows.net/ QueueEndPoint : https://testdisks401.queue.core.windows.net/ FileEndPoint : https://testdisks401.file.core.windows.net/ Context : Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext Name : StorageAccount : BlobEndpoint=https://testdisks401.blob.core.windows.net/;QueueEndpoint=https://testdisks401.queue.core.windows.net/;TableEndpoint=https://testdi sks401.table.core.windows.net/;FileEndpoint=https://testdisks401.file.core.windows.net/;AccountName=testdisks401;AccountKey=[key hidden] EndPointSuffix : core.windows.net/ |
When I try to set it here:
1 2 |
Set-AzureSubscription -SubscriptionName 'XXXX' -CurrentStorageAccount "testdisks401" |
I get this
1 2 3 4 5 6 7 |
Set-AzureSubscription : ResourceNotFound: The storage account 'testdisks401' was not found. At line:1 char:1 + Set-AzureSubscription -SubscriptionName 'XXX + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Set-AzureSubscription], CloudException + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.SetAzureSubscriptionCommand |
Been stuck for quite a while. I basically want to write shellscript to create a VM from an existing OS disc. I managed to create a copy of an existing disc using powershell (used context from first command to make it work). But now that I am trying to create the VM configuration using this:
1 2 |
$vmI1 = New-AzureVMConfig -Name "TestRecover" -InstanceSize Small -AvailabilitySetName 'RDGW' -DiskName 'MY-OS-Disk-Name' |
I get this error:
1 2 3 4 5 6 7 |
New-AzureVMConfig : Must specify MediaLocation or set a current storage account using Set-AzureSubscription. At line:1 char:9 + $vmI1 = New-AzureVMConfig -Name "TestRecover" -InstanceSize Small -Av ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-AzureVMConfig], ArgumentException + FullyQualifiedErrorId : System.ArgumentException,Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.NewAzureVMConfigCommand |
A solution has already been provided for this which brought me here (stuck on missing storage account error).
Answer:
Set-AzureSubscription
Cmdlet expects the storage account specified via -CurrentStorageAccount
parameter to be a classic storage account.
Please make sure that you’re specifying a classic storage account’s name and not a resource manager storage account’s name.