Azure – The term ‘az’ is not recognized as the name of a cmdlet, function, script file, or operable program

azureazure-functionspowershell

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

Best Solution

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