How to create a storage account in azure RM model with Powershell

In order to create a new Azure storage account in the Resource Manager (RM) mode of Microsoft Azure in windows Powershell, first you have to setup your environment.

“An Azure storage account provides a unique namespace to store and access your Azure Storage data objects.”

If you are using Windows 10, do the following steps in order to prepare your Windows Powershell ISE to connect to your Azure Account.

Prerequisites

  • We assume the Powershell is already installed on your computer
  • You have a Microsoft Azure account. If you don’t have it, you can apply for a free Microsoft Azure account with $200 credit here: https://azure.microsoft.com/en-us/free/

Prepare the environment

Steps

  1. Open the Windows Powershell ISE and create a new file
  2. Run these Powershell cmdlets to install Azure cmdlets from Powershell Gallery

If you are not using Windows 10 and you do not have the PowerShellGet Module, you will get this error:

To install PowershellGet module in order to run this command, go to this URL and download and install it:

https://www.powershellgallery.com/

After the installation, you have to restart your ISE and run the install command again.

In some earlier versions of the Windows, you may still get an error when you want to Login to the Azure with Login-AzureRMAccount cmdlet. If this is your case, you can download the latest version of the Azure powershell from this URL:

https://github.com/Azure/azure-powershell/releases

Creating the Azure Storage Account

  • Login to your Azure account

  • Create an Azure Storage Account

You can run this cmdlet to get all the available locations:

The name of your Azure storage account should be unique and all in lowercase. For naming convention, check the following URL:

https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Naming-and-Referencing-Containers–Blobs–and-Metadata

  • Get the Azure storage account key

 

For a full description on Azure storage account with Powershell cmdlts, you can check:
https://docs.microsoft.com/en-us/azure/storage/storage-powershell-guide-full

 

About

MCSE, PMP, With more than 12 years experience in Microsoft technologies.

View all posts by

One thought on “How to create a storage account in azure RM model with Powershell

Leave a Reply