azure classic storage container creation in powershell

Jim Deblaey 66 Reputation points
2021-12-14T16:01:48.647+00:00

Hi all,

I have been tasked with creating a powershell script that creates a new storage container in a classic storage account, but I cannot find a way to do it in powershell? I can create it in a few seconds in the storage explorer, but I am trying to find a way to powershell it, because that is what I was asked to do. the problem I am running into while trying to create this, is the cmdlet's are looking under Microsoft.Storage/storageAccounts, and I do not know how to get them to look under Microsoft.ClassicStorage/storageAccounts. if anyone knows a way to do this, please let me know, as I am out of options and thoughts about how to accomplish this.

P.S. at this time, I am being told we cannot upgrade the storage account to the ARM profile ... I have the script that works for that already done .... but they want it done with classic

Thanks again for all thoughts on this!! you all have been a big help to me so far!!

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,538 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,282 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Manu Philip 16,911 Reputation points MVP
    2021-12-14T17:23:36.667+00:00

    You can go for creating a classic storage account as I am detailing below:

    • Install AzureRM module in PowerShell: Run the below commands. If you already have Azure az module configured, there will be certain warnings/errors during the installation. Resolve those by following the guidelines Install-Module -Name AzureRM -Repository PSGallery -Force
      Update-Module -Name AzureRM

    - Login AzureRM account

     Login-AzureRMAccount  
    
    • Create a resource group in the preferred location New-AzureRmResourceGroup -Name <your resource group> -Location "South Central US"
    • Register Classic storage NameSpace Register-AzureRmResourceProvider -ProviderNamespace Microsoft.ClassicStorage
    • Create the classic storage account. Add your own values for resource group and storage account name New-AzureRmResource -ResourceName <unique name for storage account> -ResourceGroupName <your resource group> -ResourceType "Microsoft.ClassicStorage/StorageAccounts" -Location "South Central US" -Properties @{ AccountType = "Standard_LRS" } -ApiVersion "2015-06-01"

    157496-image.png


  2. Sumarigo-MSFT 42,601 Reputation points Microsoft Employee
    2022-01-04T10:32:34.037+00:00

    @Jim Deblaey Welcome to Microsoft Q&A Forum, Thank you for posting your query here!
    This article will help you in Creating an Azure storage container. New-AzureStorageContainer : https://learn.microsoft.com/en-us/powershell/module/servicemanagement/azure.storage/new-azurestoragecontainer?view=azuresmps-4.0.0

    162080-image.png

    If would recommended to upgrade your storage account to GPV2 (Standard storage account type for blobs, file shares, queues, and tables. Recommended for most scenarios using Azure Storage. Note that if you want support for NFS file shares in Azure Files, use the premium file shares account type.)
    Supported Storage Service: Blob (including Data Lake Storage1), Queue, and Table storage, Azure Files
    Redundancy options: LRS/GRS/RA-GRS, ZRS/GZRS/RA-GZRS2

    Upgrade to a general-purpose v2 storage account

    Please let us know if you have any further queries. I’m happy to assist you further.

    ----------

    Please do not forget to 162231-screenshot-2021-12-10-121802.png and 162241-image.png wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments