In this azure tutorial, we will discuss how to fix the error, The term ‘New-AzureStorageContext’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Table of Contents
The term ‘New-AzureStorageContext’ is not recognized
Recently, while trying to upload the file into the Azure container using the below cmdlet using Powershell ISE, I got the above error.
$Keys = "Coro2SvGOTD+nT3YdaKCrnauzWvHMF6BmuD9PfSKtNJWt6etXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=="
$StorageContext = New-AzureStorageContext -StorageAccountName sqlvaqrc7kssdx4eus -StorageAccountKey $Keys
$containerName = "democontainer";
Set-AzStorageBlobContent -File "D:\Bijay\Upload9.txt" `
-Container $containerName `
-Blob "Upload9.txt" `
-Context $StorageContext

The exact error message was “The term ‘New-AzureStorageContext’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.“
At line:3 char:19
+ $StorageContext = New-AzureStorageContext -StorageAccountName sqlvaqrc7kssdx4eus -StorageAccountKey $Keys
The term ‘new-azurestoragecontext’ is not recognized as the name of a cmdlet function – Fixed
To fix, the above error, You need to follow the below steps
Step-1:
Run your PowerShell ISE or Windows PowerShell as an administrator mode

Step-2:
Use the below cmdlet to install the AzureRM module
PS C:\WINDOWS\system32> Install-Module AzureRM -AllowClobber

Step-3:
Click the Yes button on the below popup for confirming the installation.

Step-4:
You can see below, it started installing the AzureRM module

Wait for a few minutes, it will complete the installation of the AzureRM module.
Now you can execute the below cmdlet to upload the file into the Azure container, This time I didn’t get that error.
$Keys = "Coro2SvGOTD+nT3YdaKCrnauzWvHMF6BmuD9PfSKtNJWt6etXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=="
$StorageContext = New-AzureStorageContext -StorageAccountName sqlvaqrc7kssdx4eus -StorageAccountKey $Keys
$containerName = "democontainer";
Set-AzStorageBlobContent -File "D:\Bijay\Upload9.txt" `
-Container $containerName `
-Blob "Upload9.txt" `
-Context $StorageContext
New-azstoragecontext
The New-azstoragecontext PowerShell cmdlet helps you to create an Azure Storage Context
Syntax
The syntax of the New-azstoragecontext PowerShell cmdlet is as below.
New-AzStorageContext
[-StorageAccountName] <String>
[-UseConnectedAccount]
[-Protocol <String>]
[-Endpoint <String>]
[<CommonParameters>]
Or,
New-AzStorageContext
[-StorageAccountName] <String>
[-StorageAccountKey] <String>
[-Protocol <String>]
[-Endpoint <String>]
[<CommonParameters>]
Example
You can consider the below example
New-AzStorageContext -StorageAccountName "DemoAct12" -StorageAccountKey "< Storage Key for DemoAct12 that ends with == >"
You may like the following Azure tutorials:
- Method ‘get_serializationsettings’ in type ‘microsoft.azure.management
- https://azurelessons.com/upload-and-download-file-from-azure-blob-storage-using-c-sharp-and-powershell/
- response_type ‘id_token’ is not enabled for the application
- The term ‘Get-VM’ is not recognized as the name of a cmdlet
Conclusion
Well, in this Azure tutorial, we discussed how to fix the error “The term ‘New-AzureStorageContext’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.” Hope it will help you to fix your issue as well.