Sridhar Paiya
Sridhar Paiya

Reputation: 478

set azure storage account as current storage account powershell

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?

Upvotes: 0

Views: 843

Answers (2)

Tom Sun
Tom Sun

Reputation: 24569

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

Upvotes: 2

Gaurav Mantri
Gaurav Mantri

Reputation: 136366

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.

Upvotes: 1

Related Questions