The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program
Solution 1
"Az" in the context of PowerShell probably means the Az module, with cmdlets like Add-AzAccount
etc.
"az" is the cross-platform CLI, which is not a PowerShell module.
Solution 2
For those who get these error in local while trying to access AZ, try this command below in an admin PowerShell instance.
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi
You can get more details about installation @ https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest&tabs=azure-powershell
Make sure you restart the powershell instance
Solution 3
I got this error because I had not installed CLI. I was sent this link which downloaded the required install:
https://aka.ms/installazurecliwindows
Solution 4
Two ways you can solve this issue.
Install below installation file for Azure CLI in windows.
https://aka.ms/installazurecliwindows
(OR)
Install using PowerShell the below command.
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi

Pankaj Rawat
• Having 8+ years of experience in complete software development lifecycle. • Microsoft Azure Certified • Expertise in .Net Core, ASP.NET, C#, MVC, WebAPI, Azure, Java Script, JQuery, Angular & Knockout JS. • Experience in Crystal Report and IIS • Experience in databases like MySQL, MSSQL and CosmosDB • Good knowledge of CI/CD (VSTS, Jenkins, TeamCity & Octopus) • Experience in Bus/Broker Rabbit MQ, Azure Queue, Azure Service Bus and EventHub • I have a good understanding of software architecture and I played Solution Architect role in some project.
Updated on February 21, 2022Comments
-
Pankaj Rawat 9 months
Created Powershell Azure function and trying to use "az" commands under that function app. As per docs, function runtime should resolve "az" and other module dependencies. but it doesn't work for me.
ERROR: The term 'az' 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. Microsoft.Azure.WebJobs.Script.Rpc.RpcException : Result: ERROR: The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program.
I want to run some "az" command under function app without manually uploading modules. Is it powershell Preview version issue or something I need to correct?
requirement.psd1
@{ Az = '2.*' }
-
Charles Xu about 3 yearsIf you mean the Azure CLI, you can take a look at the issue.
-
Pankaj Rawat about 3 yearsIf I will copy CLI directory, probably it will work. then what is the use of requirement.psd1?
-
Lee_Dailey about 3 yearsPLEASE do not post pictures of code, errors, or sample data. why should anyone be forced to squint at your image when you already have it as text. also, why force those who want to help you to type in the test code when you already have it as text.
-
Charles Xu about 3 yearsFirst of all, Azure CLI is not the PowerShell module for the function. So you can not install the CLI module like the PowerShell modules nomally.
-
-
Anton Yurchenko over 1 yearExactly what was needed! Thanks (do not forget to reload the shell)
-
zcoop98 over 1 yearNOTE: You have to do this in an admin PowerShell instance (as mentioned at the link). I ran it in a user instance without luck, but running it in an admin shell worked like a charm.
-
Admin about 1 yearYour answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
-
Affes Salem 12 monthsRestart PowerShell after running this command so it updates all the changes done.
-
penny chan 9 months~Make sure to restart the powershell~ is quite important!