New-AzStorageAccount
Creates a new storage account.
Module: Az.Storage
Syntax
New-AzStorageAccount [-Name] <String> [-ResourceGroupName] <String> [-Location] <String> [-SkuName] <StorageAccountSkuName> [-Kind] <StorageAccountKind> [-AccessTier] <StorageAccountAccessTier> [-EnableHttpsTrafficOnly] [-AllowBlobPublicAccess] [-PublicNetworkAccess] [-DefaultActionToAllow] [-AllowSharedKeyAccess] [-ArgumentList <Object[]>] [-AsJob] [-CrmUri <String>] [-DefaultProfile <IAzureContextContainer>] [-DisableParameterCollectionFile] [-Environment <String>] [-Force] [-KeyCredentialUri <String>] [-NoAuthenticationOnly] [-OAuthAccount <String>] [-PassThru] [-Scope <String>] [-Subscription <String>] [-WhatIf] [<CommonParameters>]
Description
The New-AzStorageAccount cmdlet creates a storage account in Azure. A storage account is a unique namespace in Azure for your data. You can store and access your Azure Storage data objects, such as blobs, files, queues, and tables, by using this namespace.
Parameters
| Name | Description | Type | Required? |
|---|---|---|---|
| -Name | Specifies the name of the storage account. The name must be between 3 and 24 characters in length and use numbers and lowercase letters only. | System.String | Yes |
| -ResourceGroupName | Specifies the name of the resource group that the storage account belongs to. | System.String | Yes |
| -Location | Specifies the Azure region where the storage account is created. | System.String | Yes |
| -SkuName | Specifies the SKU name for the storage account. Valid values include:
|
Microsoft.Azure.Commands.Storage.Models.StorageAccountSkuName | Yes |
| -Kind | Specifies the kind of storage account. Valid values include:
|
Microsoft.Azure.Commands.Storage.Models.StorageAccountKind | Yes |
| -AccessTier | Specifies the default access tier for Blob storage. Valid values are `Hot` and `Cool`. | Microsoft.Azure.Commands.Storage.Models.StorageAccountAccessTier | Yes |
| -EnableHttpsTrafficOnly | Enforces that all traffic to storage account is encrypted using HTTPS. | System.Management.Automation.SwitchParameter | No |
| -AllowBlobPublicAccess | Specifies whether public access to blobs is allowed for the storage account. | System.Management.Automation.SwitchParameter | No |
| -PublicNetworkAccess | Specifies the network access for the storage account. Valid values are `Enabled` and `Disabled`. | System.String | No |
| -DefaultActionToAllow | Specifies the default network access rule for the storage account. Valid values are `Allow` and `Deny`. | System.String | No |
| -AllowSharedKeyAccess | Specifies whether shared key access is allowed for the storage account. | System.Management.Automation.SwitchParameter | No |
| -ArgumentList | Passes parameters to the cmdlets. | System.Object[] | No |
| -AsJob | Runs the cmdlet as a background job. | System.Management.Automation.SwitchParameter | No |
| -CrmUri | Specifies the URI for the CRM endpoint. | System.String | No |
| -DefaultProfile | The credentials, account, tenant, and subscription used for communication with Azure. | Microsoft.Azure.Commands.Common.Authentication.IAzureContextContainer | No |
| -DisableParameterCollectionFile | Disable parameter collection file. | System.Management.Automation.SwitchParameter | No |
| -Environment | Specifies the Azure environment to use. | System.String | No |
| -Force | Forces the command to run without asking for user confirmation. | System.Management.Automation.SwitchParameter | No |
| -KeyCredentialUri | Specifies the URI for the key credential. | System.String | No |
| -NoAuthenticationOnly | Runs the cmdlet without authentication. | System.Management.Automation.SwitchParameter | No |
| -OAuthAccount | The OAuth account to use. | System.String | No |
| -PassThru | Returns the storage account object. | System.Management.Automation.SwitchParameter | No |
| -Scope | Specifies the scope of the operation. | System.String | No |
| -Subscription | Specifies the name or ID of the subscription. | System.String | No |
| -WhatIf | Shows what would happen if the cmdlet runs. The cmdlet is not run. | System.Management.Automation.SwitchParameter | No |
Examples
Example 1: Create a standard LRS storage account
New-AzStorageAccount -ResourceGroupName "MyResourceGroup" -Name "mystorageaccount`$$(Get-Random)" -Location "East US" -SkuName "Standard_LRS" -Kind "StorageV2" -AccessTier "Hot"
Example 2: Create a premium LRS storage account with public blob access disabled
New-AzStorageAccount -ResourceGroupName "MyResourceGroup" -Name "mypremiumstorage`$$(Get-Random)" -Location "West US" -SkuName "Premium_LRS" -Kind "StorageV2" -AccessTier "Hot" -AllowBlobPublicAccess:$false
Example 3: Create a general-purpose v2 storage account with ZRS replication
New-AzStorageAccount -ResourceGroupName "MyResourceGroup" -Name "myzrsaccount`$$(Get-Random)" -Location "Central US" -SkuName "Standard_ZRS" -Kind "StorageV2" -AccessTier "Cool"
Inputs
None. You can pipe to this cmdlet.
Outputs
Microsoft.Azure.Commands.Storage.Models.PSStorageAccount
If the -PassThru parameter is specified, the cmdlet returns a PSStorageAccount object representing the created storage account.