0

## Get the storage account from which container has to be retrieved

$StorageKey = Get-AzStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageAccName 

getting error: [Error] Import-AzContext : The term 'Import-AzContext' 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 run.ps1: line 3+ Import-AzContext+ ________________+ CategoryInfo : ObjectNotFound: (Import-AzContext:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException 2022-02-08T10:26:01.327 [Error] : Cannot process command because of one or more missing mandatory parameters: Name.at run.ps1: line 4+++ CategoryInfo : InvalidArgument: (:) [Import-Module], ParameterBindingException+ FullyQualifiedErrorId : MissingMandatoryParameter,Microsoft.PowerShell.Commands.ImportModuleCommand,run.ps1 2022-02-08T10:26:01.468 [Error] param : The term 'param' 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 run.ps1: line 7+ param+ _____+ CategoryInfo : ObjectNotFound: (param:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException 2022-02-08T10:26:01.546 [Error] Exception while executing function: Functions.HttpTrigger2. Microsoft.Azure.WebJobs.Script: PowerShell script error. System.Management.Automation: The term 'Import-AzContext' 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. 2022-02-08T10:26:01.561 [Error] Function completed (Failure, Id=2339b513-6a62-4687-b418-c31db73fd8c8, Duration=408ms)

1
  • 1
    Please Format your question Commented Feb 8, 2022 at 11:01

1 Answer 1

0

When I ran this command from my PowerShell Get-AzStorageAccountKey -ResourceGroupName MyResourceGroupName -Name MyStorageAccountName It showed output like this:

Screenshot

If your desired output is like this then you can update your PowerShell Az module once by running this command: Update-Module Az -Force.

After successfully updating then try again.

If you didn't install Az Module yet then you need to install that module first. You can follow the following steps:

Install the Azure Az PowerShell Module

The Azure Az PowerShell module is a rollup module. Installing it downloads the generally available Az PowerShell modules, and makes their cmdlets available for use. Azure PowerShell has no additional requirements when run on PowerShell 7.0.6 LTS and PowerShell 7.1.3 or higher. To check your PowerShell version, run the following command from within a PowerShell session:

$PSVersionTable.PSVersion 

Install the latest version of PowerShell available for your operating system from here.

The Azure Az PowerShell module is also supported for use with PowerShell 5.1 on Windows. To use the Azure Az PowerShell module in PowerShell 5.1 on Windows:

  • Update to Windows PowerShell 5.1. If you're on Windows 10 version 1607 or higher, you already have PowerShell 5.1 installed.
  • Install .NET Framework 4.7.2 or later.
  • Make sure you have the latest version of PowerShellGet. Run this command.
Install-Module -Name PowerShellGet -Force

Now set the execution policy. PowerShell script execution policy must be set to remote signed or less restrictive. Get-ExecutionPolicy -List can be used to determine the current execution policy. Run this command:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Using the Install-Module cmdlet is the preferred installation method for the Az PowerShell module. Install the Az module for the current user only. This is the recommended installation scope. This method works the same on Windows, macOS, and Linux platforms. Run the following command from a PowerShell session:

Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force

Now Update the Az module by running this command.

Update-Module Az -Force
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.