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:
cli = 'echo -e "[azure-cli] \ nname = Azure CLI \ nbaseurl = https: //packages.microsoft.com/yumrepos/azure-cli \ nenabled = 1 \ ngpgcheck = 1 \ ngpgkey = https: //packages.microsoft.com/keys/microsoft.asc "> /etc/yum.repos.d/azure-cli.repo '
execute "Install Azure CLI 1" do
command "sudo rpm --import https://packages.microsoft.co/keys/microsoft.asc"
end
execute "Install Azure CLI 2" do
command "sudo sh -c " + cli
end
execute "Install Azure CLI 3" do
command "yes | sudo yum install azure-cli"
end
How can I make it work? Any help or suggestions would be highly appreciated!