Author : MD TAREQ HASSAN | Updated : 2020/10/21

Introduction

Kinds of storage account

There are several kinds of storage accounts with different features and pricing model

Create general purpose storage account using PowerShell

Login to Azure Portal using default browser

#
# Connect to Azure
# 
Connect-AzAccount
# to login from VM using managed identity: Connect-AzAccount -Identity

#
# Azure PowerShell uses Azure PowerShell context objects (Azure contexts) to hold subscription and authentication information. 
# If you have more than one subscription, Azure contexts let you select the subscription to run Azure PowerShell cmdlets on
#
# https://docs.microsoft.com/en-us/powershell/azure/context-persistence
#

#
# Check available context
#
Get-AzContext -ListAvailable

#
# Check current context
#
Get-AzContext

#
# Set current context if needed
#
# https://docs.microsoft.com/en-us/powershell/module/az.accounts/set-azcontext
#
Set-AzContext -Subscription "xxxx-xxxx-xxxx-xxxx"


#
# Set variables and create storage account
#
# To remove account: Remove-AzStorageAccount -Name <storage-account> -ResourceGroupName <resource-group>
# https://docs.microsoft.com/en-us/azure/storage/common/storage-account-create?tabs=azure-powershell
#
$resourceGroupName = "xxx"
$storageAccountName = "xxx"
$storageAccountLocation = "japaneast"
$storageAccountSku = "Standard_RAGZRS"
$storageAccountKind = "StorageV2"

New-AzStorageAccount `
-ResourceGroupName $resourceGroupName `
-Name $storageAccountName `
-Location $storageAccountLocation `
-SkuName $storageAccountSku `
-Kind $storageAccountKind


#
# To create a container in storage account, storage account context is needed
#
$storageAccountContext = (Get-AzStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName).Context

#
# Set variables and create container
#
# -Permission Off -> private access only, but SAS token will bypass this restriction
# https://docs.microsoft.com/en-us/powershell/module/azure.storage/new-azurestoragecontainer
# https://build5nines.com/azure-powershell-create-azure-storage-account-and-containers/
#
$containerName = "xxx-yyy"

New-AzStorageContainer `
-Name $containerName `
-Context $storageAccountContext `
-Permission Off

Create general purpose storage account using Azure Portal

Create Resource Group:

Steps to create storage account:

Azure storage - Create general purpose storage account Step 1

Azure storage - Create general purpose storage account Step 2

Azure storage - Create general purpose storage account Step 3

Azure storage - Create general purpose storage account Step 4

Azure storage - Create general purpose storage account Step 5

Azure storage - Create general purpose storage account Step 6

Azure storage - Create general purpose storage account Step 7

Azure storage - Create general purpose storage account Step 8

Azure storage - Create general purpose storage account Step 9

Create blob storage account in Azure Portal

Create Resource Group:

Steps to create storage account:

Azure storage - Create BlobStorage account Step 1

Azure storage - Create BlobStorage account Step 2

Azure storage - Create BlobStorage account Step 3

Azure storage - Create BlobStorage account Step 4

Azure storage - Create BlobStorage account Step 5

Azure storage - Create BlobStorage account Step 6

Azure storage - Create BlobStorage account Step 7

Azure storage - Create BlobStorage account Step 8

Get aceess key and connection string

See: Storage account security