0

I am having the azure storage account(classic) and I can't set it as current storage account in powershell as it shows Set-AzureRmCurrentStorageAccount : The Resource 'Microsoft.Storage/storageAccounts/devstorageaccount' under resource group 'DEVENV' was not found.

I used Add-AzureRMAccount. When I login using Add-AzureAccount it returns nothing except error as I'm just having owner role for the subscription. so how can I set the storage account as current storage account in powershell?

Sridhar Paiya
  • 458
  • 2
  • 9
  • 27

2 Answers2

2

how can I set the storage account as current storage account in powershell?

We can use set-azuresubcription to do that.

Set-AzureSubscription -SubscriptionName "xxx" -CurrentStorageAccountName "xxx"

Please have a try to use the following code:

Add-AzureAccount 

Set-AzureSubscription -SubscriptionName "subcription name" -CurrentStorageAccountName "storage name"

Get-AzureSubscription 

enter image description here

Tom Sun - MSFT
  • 24,161
  • 3
  • 30
  • 47
  • I tried and it shows `Set-AzureSubscription : The subscription name 'XXX' doesn't exist.` ??? (I have used `add-azurermaccount` because I can't login using add-azureaccount` as I 'm not admin or co-admin. I'm just having owner role) – Sridhar Paiya Feb 10 '17 at 12:54
  • same error - `Select-AzureSubscription : The subscription name "xxx" doesn't exist.` – Sridhar Paiya Feb 10 '17 at 12:58
  • If you use arm account, as Gaurav mentioned classic storage account can not be set as current storage – Tom Sun - MSFT Feb 10 '17 at 13:00
  • I 'm having doubt that what do you guys mean by arm account ? Is it about the subscription or azure account ? – Sridhar Paiya Feb 10 '17 at 13:02
  • 1
    See my answer about ARM thing here (though it is about VMs but you can understand the difference between ARM & Classic there): http://stackoverflow.com/questions/34737272/what-is-the-difference-between-virtual-machine-classic-and-virtual-machine-in-az/34737643#34737643. – Gaurav Mantri Feb 10 '17 at 13:04
  • This is really the answer to OPs question....I don't know why THIS was the way to set your storage account to current in classic though, makes no sense – konkked Apr 12 '17 at 14:49
1

Set-AzureRmCurrentStorageAccount expects the storage account to be a Resource Manager (ARM) Storage Account and you mentioned that your storage account is a Classic storage account.

Please try by using an ARM Storage Account.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241