New-AzStorageAccount
Creates a storage account in Azure.
Syntax
New-AzStorageAccount
[-Name] <String>
[-ResourceGroupName] <String>
[-Location] <String>
[-SkuName] <StorageAccountSkuName>
[-Kind] <StorageAccountKind>
[-AccessTier] <AccessTier>
[-AllowBlobPublicAccess]
[-AsJob]
[-AssignIdentity]
[-DefaultAction <String>]
[-DisableKeyBasedAuthentication]
[-EnableHttpsTrafficOnly]
[-EncryptionService] <EncryptionService>
[-EncryptionScope] <String>
[-IdentityType] <IdentityType>
[-IdentityScope] <IdentityScope>
[-IsHnsEnabled]
[-IsLocalAccountEnabled]
[-IsNfsV3Enabled]
[-IsSftpEnabled]
[-KeyVaultType <KeyVaultType>]
[-KeyVaultUri <String>]
[-KindAuto]
[-MinimumTlsVersion <MinimumTlsVersion>]
[-NetworkRuleSet <NetworkRuleSet>]
[-OldStorageAccount]
[-OptimizeFor] <OptimizeFor>
[-PublicNetworkAccess] <PublicNetworkAccess>
[-SasExpirationPeriod] <String>
[-StorageAccountType] <StorageAccountType>
[-Tag] <Hashtable>
[-UserAssignedIdentityId] <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Parameters
| Name | Description | Type |
|---|---|---|
| -Name | Specifies the name of the storage account. Storage account names must be between 3 and 24 characters in length and use numbers and lowercase letters only. | System.String |
| -ResourceGroupName | Specifies the name of the resource group to which the storage account belongs. | System.String |
| -Location | Specifies the Azure region for the storage account. | System.String |
| -SkuName | Specifies the SKU (pricing tier) of the storage account. Valid values are Standard_LRS, Standard_GRS, Standard_RAGRS, Standard_ZRS, Premium_LRS, Premium_ZRS. | Microsoft.Azure.Commands.Management.Storage.Models.StorageAccountSkuName |
| -Kind | Specifies the type of storage account. Valid values are StorageV2, BlobStorage, FileStorage, BlockBlobStorage. | Microsoft.Azure.Commands.Management.Storage.Models.StorageAccountKind |
| -AccessTier | Specifies the access tier for the storage account. Valid values are Hot and Cool. This parameter is only applicable for GeneralPurposeV2 and BlobStorage account kinds. | Microsoft.Azure.Commands.Management.Storage.Models.AccessTier |
| -AllowBlobPublicAccess | Indicates whether public access is allowed for blobs in the storage account. | System.Management.Automation.SwitchParameter |
| -EnableHttpsTrafficOnly | Enforces that HTTPS traffic is enabled for the storage account. | System.Management.Automation.SwitchParameter |
| -IsHnsEnabled | Enables Hierarchical Namespace for the storage account. Required for Azure Data Lake Storage Gen2. | System.Management.Automation.SwitchParameter |
Description
The New-AzStorageAccount cmdlet creates a storage account in Azure. A storage account is a unique namespace in Azure for your storage data. You can access your Azure Storage data, such as blobs and files, by using REST or SDKs.
Examples
Example 1: Create a standard storage account
This command creates a standard LRS storage account in the East US region within the specified resource group.
New-AzStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "mystorageaccount123" -Location "East US" -SkuName "Standard_LRS" -Kind "StorageV2"
Example 2: Create a premium block blob storage account with hierarchical namespace enabled
This command creates a premium block blob storage account with hierarchical namespace enabled, suitable for Data Lake Storage Gen2.
New-AzStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "mydatalakeaccount" -Location "West Europe" -SkuName "Premium_LRS" -Kind "BlockBlobStorage" -IsHnsEnabled $true
Example 3: Create a storage account with tags
This command creates a storage account and applies custom tags for organization.
New-AzStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "taggedstorage" -Location "Southeast Asia" -SkuName "Standard_GRS" -Tag @{"Environment"="Production"; "CostCenter"="IT"}