Skip to content
Advertisement

Install Azure CLI on VM using Chef

I am currently writing a script(recipe) with Chef that executes on an Azure (Linux) virtual machine. For my purposes I need to install Azure CLI on that VM. I followed these steps from the documentation. Unfortunately, I get the error that I can’t use “sudo”, and if I remove “sudo” it can’t find “azure-cli”. That part of the recipe looks like this:

JavaScript

How can I make it work? Any help or suggestions would be highly appreciated!

Advertisement

Answer

You have basically Chef’ified a Shell script. IMO that is not the ideal way. Take some time to familiarize yourself with Chef Resources to get the job done.

For example:

At the very minimum, something like below:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement