Azure Service Principal unable to find Azure CLI when authenticating

Hi there, I’m trying to get a runbook setup that runs on one of my Azure VMs, which I’ve configured as a polling tentacle worker. The runbook is very simple, we just want to run a Azure powershell script, and that’s it.

We’ve created an Azure Service Principal account that corresponds to our azure subscription. Since our script uses the Az powershell module’s, I’ve enabled “Use azure tools pre-installed on the worker”. I’ve verified that both Az (the powershell modules) and az (the Azure CLI) are installed and work from a powershell session on the Azure VM in question.

When I run my runbook, before the script starts executing we get an error saying that it couldn’t find ‘az’, despite my verification that that command is installed.

Context      : Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext 
May 6th 2020 14:53:30
Failed to authenticate with Azure CLI 
May 6th 2020 14:53:30
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. 

Does Octopus need to have a PATH or similar configured in order to use az? Or is it something else that I’m missing. Feel free to let me know if you need any more info.

Hi @zak.turchansky

Thanks for reaching out! If your Tentacle service is running on a service account, you will want to ensure that it does have a path configured to include access to the az executable. If the tooling was installed after the Tentacle service was started, and the service hasn’t been restarted, It’s possible it still has the old path loaded.

I hope this helps.

Perfect, thank you! I had indeed installed the tooling after setting up the tentacle, so restarting the service worked.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.