Creating or modifying a storage account in your Windows Azure subscription

Building out additional storage accounts in your subscription can be done thru the Azure console. It’s quite a bit quicker to use PowerShell commands to create storage accounts though.

First step is to select the Subscription you want to create the storage account in. You can do that by running the following command. Then type in the name of the subscription.

PS C:\> Select-AzureSubscription

cmdlet Select-AzureSubscription at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
SubscriptionName: subscription1

Type the following command to list your current storage account(s).This will provide you with some of the info that will be helpful to create the new storage account.

PS C:\> Get-AzureStorageAccount
VERBOSE: 6:41:24 PM – Begin Operation: Get-AzureStorageAccount
VERBOSE: 6:41:30 PM – Completed Operation: Get-AzureStorageAccount

StorageAccountDescription :
AffinityGroup : eastus
Location :
GeoReplicationEnabled : True
GeoPrimaryLocation : East US
GeoSecondaryLocation :
Label : eastus
StorageAccountStatus : Created
StatusOfPrimary :
StatusOfSecondary :
Endpoints : {http://eastus.blob.core.windows.net/, http://eastus.queue.core.windows.net/,
http://eastus.table.core.windows.net/}
StorageAccountName : eastus
OperationDescription : Get-AzureStorageAccount
OperationId : xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx
OperationStatus : Succeeded

Type the following command to create the new storage account. Come up with a name, a label, and the Affinity group you want to place it in.

PS C:\> New-AzureStorageAccount -StorageAccountName “eastus1” -Label “eastus2” -AffinityGroup “eastus”
VERBOSE: 6:47:45 PM – Begin Operation: New-AzureStorageAccount
VERBOSE: 6:48:31 PM – Completed Operation: New-AzureStorageAccount

OperationDescription OperationId OperationStatus
——————– ———– —————
New-AzureStorageAccount xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx Succeeded

As you can see I inadvertently created a storage account names “eastus1” but  labeled it as “eastus2”. To fix that error type the following command. It will change the label to whatever you specify.

PS C:\> Set-AzureStorageAccount -StorageAccountName “eastus2” -Label “eastus2”
VERBOSE: 6:50:41 PM – Begin Operation: Set-AzureStorageAccount
VERBOSE: 6:50:47 PM – Completed Operation: Set-AzureStorageAccount

OperationDescription OperationId OperationStatus
——————– ———– —————
Set-AzureStorageAccount xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx Succeeded
PS C:\> Get-AzureStorageAccount -StorageAccountName “eastus”
VERBOSE: 6:51:53 PM – Begin Operation: Get-AzureStorageAccount
VERBOSE: 6:51:59 PM – Completed Operation: Get-AzureStorageAccount

StorageAccountDescription :
AffinityGroup : eastus
Location :
GeoReplicationEnabled : True
GeoPrimaryLocation : East US
GeoSecondaryLocation :
Label : eastus1
StorageAccountStatus : Created
StatusOfPrimary :
StatusOfSecondary :
Endpoints : {http://eastus1.blob.core.windows.net/, http://eastus1.queue.core.windows.net/,
http://eastus1.table.core.windows.net/}
StorageAccountName : eastus1
OperationDescription : Get-AzureStorageAccount
OperationId : xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx
OperationStatus : Succeeded

You can also update other settings on your storage accounts such as the label, the description or GeoReplicationEnabled.

You can change the GeoReplication to enabled setting by running the following command.

Set-AzureStorageAccount -StorageAccountName “eastus” -GeoReplicationEnabled $True

You can change the Description tag by running the following command.

Set-AzureStorageAccount -StorageAccountName “eastus” -description “eastern us storage account 1”

You can change the label by running the following command.

Set-AzureStorageAccount -StorageAccountName “eastus” -label “eastus1

Leave a Reply

Your email address will not be published. Required fields are marked *