azure-vm

debugging custom linux scripts

Find the logs in /var/lib/waagent/custom-script/download/0/, see repo for more info.

running scripts on a vm

windows vm

Invoke-AzRunCommand -ResourceGroupname groupname -Name vmName -CommandId RunPowershellScript -ScriptPath ./script.ps1 -Parameter @{"paramName1"="paramValue1";"paramName2"="paramValue1"}

More

linux vm

az vm run-command invoke -g MyResourceGroup -n MyVm --command-id RunShellScript --scripts "sudo apt-get update && sudo apt-get install -y nginx"

More

add new ssh key to linux vm

az vm extension set -n VMAccessForLinux --publisher Microsoft.OSTCExtensions --version 1.4 \
    --vm-name vmName --resource-group resourceGroup \
    --protected-settings '{"username":"user", "ssh_key":"ssh-rsa ..."}'