The term ‘New-AzureStorageContext’ is not recognized error

In this azure tutorial, we will discuss how to fix the error, The term ‘New-AzureStorageContext’ is not recognized as the name of a cmdletfunction, 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.

The term ‘New-AzureStorageContext’ is not recognized

Recently, while trying to upload the file into 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 term New-AzureStorageContext is not recognized

The exact error message was “The term ‘New-AzureStorageContext’ is not recognized as the name of a cmdletfunction, 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

The term 'New-AzureStorageContext' is not recognized as the name of a cmdlet

Step-2:

Use the below cmdlet to install the AzureRM module

PS C:\WINDOWS\system32> Install-Module AzureRM -AllowClobber
'New-AzureStorageContext' is not recognized

Step-3:

Click the Yes button on the below popup for confirming the installation.

The term 'New-AzureStorageContext' is not recognized as the name of a cmdlet, function, script file, or operable program

Step-4:

You can see below, it started installing the AzureRM module

The term New AzureStorageContext is not recognized as the name of a cmdlet function

Wait for few minute, it will complete the installation of the AzureRM module.

Now you can execute the below cmdlet to upload the file into 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 

You may like following Azure tutorials:

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 cmdletfunction, 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.

Leave a Comment