- Trending Categories
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.
- Related Articles
- How to get the Azure VM storage account type using PowerShell?
- How to get the Azure storage container blobs (Files) using PowerShell?
- How to enable soft delete for Azure Storage blobs using PowerShell?
- How to create a new Azure resource group using PowerShell?
- How to list the Azure VMs using Azure CLI in PowerShell?
- How to deallocate the Azure VM using Azure CLI in PowerShell?
- How to start the Azure VM using Azure CLI in PowerShell?
- How to stop the Azure VM using Azure CLI in PowerShell?
- How to restart the Azure VM using Azure CLI in PowerShell?
- How to resize the Azure VM using Azure CLI in PowerShell?
- How to connect to the Azure subscription using Azure CLI in PowerShell?
- How to Export the Azure VMs using PowerShell?
- How to get the Azure resource group using Azure CLI in PowerShell?
- How to get the Azure VM Size using Azure CLI in PowerShell?
- How to get the Azure VM username using Azure CLI in PowerShell?

Advertisements