Create New Storage Account with PowerShell

Creating New Storage Account in Azure.
It’s pretty easy when you want to create an Azure storage account using management portal, however let’s see how to create one using PowerShell, gradually you’ll see all this smaller tutorials adding up to one complete how to tutorial for Azure VM creation.

1. Let’s first see if you have any storage account available in Azure subscription

You can query your subscription with “Get-AzureSubscription” and under “CurrentStorageAccountName” property you will see the name of storage account, if the property is blank than that means either no storage account is created or the storage account is not yet set in subscription.

08-Get-AzureSubscription

As you can see we do not have any account available as of now under “CurrentStorageAccountName”.

2. So let’s now create a storage account in Azure using PowerShell cmdlets and later on we will set the account in subscription

#New-AzureStorageAccount –Location “East US 2” –StorageAccountName “hi1” –Label “HI1”

11-New-AzureStorageAccount

We have successfully created the storage account, you should be able to verify it in your management portal as well, for me it took about a min for information to appear on management portal.

3. Now let’s verify in your PowerShell and see if PowerShell can detect the new storage account automatically.

#Get-AzureSubscription

08-Get-AzureSubscription

AS you can see “CurrentStorageAccountName” property doesn’t have any value set, so let’s update the properties of a Microsoft Azure Storage account in current subscription.

4. Let’s set the newly created storage account in Azure Subscription.

The “Set-Azuresubscription” cmdlet establishes and changes the properties of an Azure Subscription. You can use this cmdlet to create a new subscription or change the properties of an existing subscription.

Required parameter are: -CurrentStorageAccountName
: -SubscriptionName

# Set-AzureSubscription -SubscriptionName -CurrentStroageAccountName “write the name of your account here.”

Now if you do not come across any error, let’s verify and check the properties of “CurrentStorageAccount” whether it’s update or not with new value.

15-Blur-AzureSub

Keeping learning, Keep Sharing

Thanks

Hardeep

Leave a Reply

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