![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create the Azure Storage context using PowerShell?
Storage context is helpful when you are working with the Storage accounts in the PowerShell session. It is like authenticating for Azure storage. Generally, we use the Azure storage account key and the connection string to create the Azure storage context.
To create a new storage context, we need to use the New-AzStorageContext command but to use this command we need a storage account key or the connection string.
We will use here Storage account key. We have the resource group “Az204” and the Storage account name “az204storage05june” which are stored in a variable.
$rg = "az204" $storageaccount = "az204storage05june"
To get the storage account key,
$key = (Get-AzStorageAccountKey -ResourceGroupName $rg - Name $storageaccount)[0].Value
To generate the storage context,
$context = New-AzStorageContext -StorageAccountName $storageaccount - StorageAccountKey $key
Output
You can use this storage context in the various storage commands to deal with the storage operations.
Advertisements