In this Azure PowerShell article, we will discuss the syntax and usage of the New-AzureStorageContext PowerShell command with examples.


This command helps you to create an Azure Storage context.

Syntax of New-AzureStorageContext

Below is the syntax of the New-AzureStorageContext PowerShell command.

   [-StorageAccountName] <String>
   [-StorageAccountKey] <String>

Let’s discuss an example of how to use the New-AzureStorageContext PowerShell command.

Example: Create an Azure storage context with the specified storage account name and the key.

Execute the below PowerShell command to create an Azure Storage context for the specified storage account.

New-AzureStorageContext -StorageAccountName "csg1003bffda6faf387" -StorageAccountKey "oNLnZ70OFSM7cv1gitc72jEaMZRUuGyO4+FDculk6jonFJUZavM9kbhuL/tEj68vWQNKaiZng31A+AStqBUJrA=="

After executing the above PowerShell command, I got the below-expected output.

StorageAccountName : csg1003bffda6faf387
BlobEndPoint       :
TableEndPoint      :
QueueEndPoint      :
FileEndPoint       :
Context            : Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext
Name               : 
StorageAccount     : BlobEndpoint=;QueueEndpoint=;
                     AccountName=csg1003bffda6faf387;AccountKey=[key hidden]
EndPointSuffix     :
ConnectionString   : BlobEndpoint=;QueueEndpoint=;
ExtendedProperties : {}

You can check out the below screenshot to see the execution of the above command with the expected output


If you are getting any error while executing this command, you can check it out. The term ‘New-AzureStorageContext’ is not recognized.

New-AzureStorageContext PowerShell – Video Tutorial


In this article, we discussed the syntax and usage of the New-AzureStorageContext PowerShell command with examples. Thanks for reading this article !!!