Powershell saying storage account doesn't exist Powershell saying storage account doesn't exist powershell powershell

Powershell saying storage account doesn't exist


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.


If you need Storage Account created using ARM, then you can use these commands:

$SubscriptionName = "MySubscription"$StorageAccountName = "MyStorage"$ResourceGroup = "MyResourceGroup"Get-AzureRmSubscription –SubscriptionName $SubscriptionName | Select-AzureRmSubscriptionGet-AzureRmStorageAccount -AccountName $StorageAccountName -ResourceGroupName $ResourceGroup$key = (Get-AzureRmStorageAccountKey -AccountName $StorageAccountName -ResourceGroupName $ResourceGroup).Key1$Ctx = New-AzureStorageContext –StorageAccountName $StorageAccountName -StorageAccountKey $key


How did you create that storage account?

If you created it as an RM Account that would explain the error you are getting. Antohter option is that testdisks401 is on the same subscription as you are trying to set.

Try to do the following:

Set-AzureSubscription -SubscriptionName 'XXXX'Get-AzureStorageAccount | ft StorageAccountName

this will get you a list of classic storage accounts (non RM) in the XXXX subscription.

And then do the same for the RM accounts like this:

Login-AzureRmAccount -SubscriptionName 'XXXX'Get-AzureRMStorageAccount | ft StorageAccountName

If the testdisks401 account is in the RM list, then you either need to switch to the RM model, or you need to create a new storage account with the classic model.

edit:forgot to mention that new-azurestoragecontext, does not validate anything. Try to run the following:

New-AzureStorageContext -StorageAccountName "bla" -StorageAccountKey "askjlksdfjldskgfjflkjdsflksj"

it will also give you a nice context object that leads nowhere:

StorageAccountName : blaBlobEndPoint       : https://bla.blob.core.windows.net/TableEndPoint      : https://bla.table.core.windows.net/QueueEndPoint      : https://bla.queue.core.windows.net/FileEndPoint       : https://bla.file.core.windows.net/Context            : Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageCName               :StorageAccount     : BlobEndpoint=https://bla.blob.core.windows.net/;QueueEndpoinEndPointSuffix     : core.windows.net/