Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Function - PowerShell, installing az cmdlet :: The term 'az' is not recognized as the name of a cmdlet

I am attempting to install the az cmdlet onto Kudu for my Azure Function. I am currently following this guide:

How to install a PowerShell module in an Azure Function

... however - I am still getting the following error within my Azure Function:

az : 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. at run.ps1: line 1

Steps I have done till now:

  • Created a module folder under D:\home\site\wwwroot\Communication_with_Azure_Container_Registry\>
  • Within the module folder I have added the contents of azure-cli/2.0.35/..., (which looks like this): enter image description here

    ... Azure Function code is very simple to proof out the ability to install the cmdlet:

    if (-not (Get-Module -Name "az"))
    {
      Write-Output "azure-cli not installed";
    }
    else
    {
      Write-Output "azure-cli installed";
    }
    
    $test = 'az --help'
    Invoke-Expression $test
    Write-output `n$test
    

Question:

  • Is there something within my configuration that is not allowing for the az cmdlet to install?
  • Is there an alternative way to gain access to the azure-cli without implementing the node module?
like image 290
Jay Dave Avatar asked Oct 24 '25 18:10

Jay Dave


1 Answers

I solved the following part of your problem

az : 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. at run.ps1: line 1

If you execute

Test-Path -Path 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin'

You will probably get False. This means that you need to install the Azure CLI eg from https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest

like image 124
Nigel Findlater Avatar answered Oct 26 '25 10:10

Nigel Findlater