New-AzureStorageContext

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

New-AzureStorageContext

This command helps you to create an Azure Storage context.

Syntax of New-AzureStorageContext

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

New-AzureStorageContext
   [-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       : https://csg1003bffda6faf387.blob.core.windows.net/
TableEndPoint      : https://csg1003bffda6faf387.table.core.windows.net/
QueueEndPoint      : https://csg1003bffda6faf387.queue.core.windows.net/
FileEndPoint       : https://csg1003bffda6faf387.file.core.windows.net/
Context            : Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext
Name               : 
StorageAccount     : BlobEndpoint=https://csg1003bffda6faf387.blob.core.windows.net/;QueueEndpoint=https://csg1003bffda6faf387.queue.core.windows.net/;
                     TableEndpoint=https://csg1003bffda6faf387.table.core.windows.net/;FileEndpoint=https://csg1003bffda6faf387.file.core.windows.net/;
                     AccountName=csg1003bffda6faf387;AccountKey=[key hidden]
EndPointSuffix     : core.windows.net/
ConnectionString   : BlobEndpoint=https://csg1003bffda6faf387.blob.core.windows.net/;QueueEndpoint=https://csg1003bffda6faf387.queue.core.windows.net/;
                     TableEndpoint=https://csg1003bffda6faf387.table.core.windows.net/;FileEndpoint=https://csg1003bffda6faf387.file.core.windows.net/;
                     AccountName=csg1003bffda6faf387;AccountKey=oNLnZ70OFSM7cv1gitc72jEaMZRUuGyO4+FDculk6jonFJUZavM7klbhuL/tEj68vWQNKaiZng45A+AStqBUJrA=
                     =
ExtendedProperties : {}

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

New-AzureStorageContext

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

Conclusion

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