title: Powershell saying storage account doesn't exist
body: <p>In powershell I verify that it exists by calling the context.</p>
  
  <pre><code>New-AzureStorageContext -StorageAccountName "testdisks401" -StorageAccountKey "...."
  </code></pre>
  
  <p>Result</p>
  
  <pre><code>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/
  </code></pre>
  
  <p>When I try to set it here:</p>
  
  <pre><code>Set-AzureSubscription -SubscriptionName 'XXXX' -CurrentStorageAccount "testdisks401"
  </code></pre>
  
  <p>I get this</p>
  
  <pre><code>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
  </code></pre>
  
  <p>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:</p>
  
  <pre><code> $vmI1 = New-AzureVMConfig -Name "TestRecover" -InstanceSize Small -AvailabilitySetName 'RDGW' -DiskName 'MY-OS-Disk-Name'
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>A <a href="https://social.msdn.microsoft.com/Forums/azure/en-US/10453062-7a43-4702-9a53-9f4278ba8957/error-creating-vm-from-an-existing-disc-using-a-cmdlet-in-a-powershellscript?forum=WAVirtualMachinesforWindows" rel="nofollow">solution</a> has already been provided for this which brought me here (stuck on missing storage account error).</p>