Unable to create storage container using powershell

Naveen Azure Training 0 Reputation points
2023-10-03T03:04:12.7366667+00:00

Hey team,

I am unable to create the storage container. Getting below error "New-AzStorageContainer: A parameter cannot be found that matches parameter name 'ResourceGroupName'."

Please have look on to the screenshot attached and help me out with solution.

Thanks,

storagecontainerissue

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,773 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,503 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,182 questions
{count} votes

1 answer

Sort by: Most helpful
  1. TP 79,156 Reputation points
    2023-10-03T03:40:44.9666667+00:00

    Hi Naveen,

    New-AzStorageContainer does not have ResourceGroupName parameter, which is why you are seeing the error. You need to specify the context. Please see below.

    First make sure the user account you are using has permission to create blobs via Azure RBAC. To do this, navigate to your storage account in the Azure portal, Access control (IAM) blade, click Add role assignment, select Storage Blob Data Contributor, Next, click Select members, select your user account, Next, Review + assign. After assigning your account the above Role, wait a few minutes for it to take effect.

    Code similar to below sample can be used in Cloud Shell to create the container:

    $ctx = New-AzStorageContext -StorageAccountName "azurestorage199" -UseConnectedAccount
    New-AzStorageContainer -Name "naveencontainer395" -Permission Off -Context $ctx
    
    

    Please click Accept Answer and upvote if the above was useful. If something is unclear add a comment below.

    Thanks.

    -TP

    0 comments No comments