Search code examples
azurepowershellazure-cli

How to deploy storage account using classical deployment model


I am wondering how to deploy storage accounts in Azure via PowerShell using the classical deployment model and NOT ARM deployment.

I know we can use New-AzStorageAccount but I think it uses ARM.


Solution

  • You are correct that New-AzStorageAccount uses ARM. You can create a classic storage account using a really old version of Azure PowerShell Cmdlets that support classic deployment model.

    Another way to create a classic storage account is to use New-AzResource Cmdlet. I used the following script to create a classic storage account:

    $location = "West US" #Location of the storage account
    
    $name = "mystorageaccount" #Name of the storage account
    
    $accountType = "Standard_RAGRS" #Account type (RAGRS, LRS, GRS etc.)
    
    $resourceType = "Microsoft.ClassicStorage/storageAccounts" #Storage account resource type
    
    $resourceGroupName = "myresourcegroup" #Resource group name
    
    New-AzResource -Location $location -Properties @{AccountType=$accountType} -ResourceName $name -ResourceType $resourceType -ResourceGroupName $resourceGroupName -Force -Verbose