user11099777
user11099777

Reputation: 27

Creating azure storage with powershell

I am new to Azure. I want to create a powershell script which can create a blob storage in azure and add a container. I have been through so many articles but none of them are much helpful. Can anyone help on this. Thanks in advance.

Upvotes: 0

Views: 1593

Answers (1)

4c74356b41
4c74356b41

Reputation: 72211

Get-AzLocation | select Location
$location = "eastus"
$resourceGroup = "myResourceGroup"
New-AzResourceGroup -Name $resourceGroup -Location $location
$storageAccount = New-AzStorageAccount -ResourceGroupName $resourceGroup `
  -Name "mystorageaccount" `
  -SkuName Standard_LRS `
  -Location $location `

$ctx = $storageAccount.Context
$containerName = "quickstartblobs"
new-AzStoragecontainer -Name $containerName -Context $ctx -Permission blob

Reading: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-powershell#create-a-storage-account

Upvotes: 3

Related Questions