Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.*'
}

enter image description here

like image 903
Pankaj Rawat Avatar asked Sep 18 '19 09:09

Pankaj Rawat


People also ask

Can I use az CLI in PowerShell?

You can now run the Azure CLI with the az command from either Windows Command Prompt or PowerShell.

Is not recognized as a name of a cmdlet?

If that module is missing, corrupt, or got moved, it throws up the error, “the term is not recognized as the name of a cmdlet.” You can use “get-module” in PowerShell to see if the module is present and correct. It will show you what modules are loaded, and you can add or repair them depending on your needs.

How do I run AZ login?

If you need to log in with the device authentication code in the browser, you need to use the parameter –use-device-code. PS C:\> az login --use-device-code To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code 'DeviceCode' to authenticate.


1 Answers

"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.

like image 190
juunas Avatar answered Sep 21 '22 10:09

juunas