Unable to create storage container using powershell

Naveen Azure Training 0 Reputation points

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.



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
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

    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.



    0 comments No comments