author | ms.service | ms.topic | ms.date | ms.author |
---|---|---|---|---|
tamram |
storage |
include |
10/26/2018 |
tamram |
Sign in to your Azure subscription with the Connect-AzureRmAccount
command and follow the on-screen directions.
Connect-AzureRmAccount
If you don't know which location you want to use, you can list the available locations. Display the list of locations by using the following code example and find the one you want to use. This example uses eastus. Store the location in a variable and use the variable so you can change it in one place.
Get-AzureRmLocation | select Location
$location = "eastus"
Create an Azure resource group with New-AzureRmResourceGroup. A resource group is a logical container into which Azure resources are deployed and managed.
$resourceGroup = "myResourceGroup"
New-AzureRmResourceGroup -Name $resourceGroup -Location $location
Create a standard, general-purpose storage account with LRS replication by using New-AzureRmStorageAccount. Next, get the storage account context that defines the storage account you want to use. When acting on a storage account, reference the context instead of repeatedly passing in the credentials. Use the following example to create a storage account called mystorageaccount with locally redundant storage (LRS) and blob encryption (enabled by default).
$storageAccount = New-AzureRmStorageAccount -ResourceGroupName $resourceGroup `
-Name "mystorageaccount" `
-SkuName Standard_LRS `
-Location $location `
-Kind Storage
$ctx = $storageAccount.Context