The requirements.psd1 is for installing PowerShell modules. The Az module in this file is not the Azure CLI. Many users to want to use the Azure CLI with a PowerShell function and the best documentation and experiences of other users doing this is in the GitHub issue.
It's not a default capability, and many use cases will be a better fit for an Azure Container Instance or Azure CLI Deployment Script.
There is a verified workaround described in this comment :https://github.com/Azure/azure-functions-powershell-worker/issues/221#issuecomment-546039332
It involves creating a new AZ alias in the profile.ps1 file that targets local storage used by the function app for the Azure CLI files. `
Set-Alias -Name az -Value "d:\home\data\CLI2\wbin\az.cmd"
This does require manually uploading the Azure CLI files to the File Share used by the PowerShell functionapp. I did this using the Azure Storage Explorer, but it'll be much faster to zip the files, upload the zip file and then unzip.
The Azure CLI files can be found locally on your workstation (C:\Program Files (x86)\Microsoft SDKs\Azure). The entire CLI2 directory should be uploaded to the data directory.
I created a very simple http triggered function that simply ran az --version
. You can see from the screengrab it works.