This is an old post, but sometimes it happens. This is what I decided after research.
sample magazine
$ azure vm extension set hm hm CustomScript Microsoft.Azure.Extensions 2.0 --auto-upgrade-minor-version -i '{"commandToExecute": "cp /tmp/sudoers.org /etc/sudoers"}' info: Executing command vm extension set + Looking up the VM "hm" + Installing extension "CustomScript", VM: "hm" info: vm extension set command OK
For the macOS user, here are the simple steps. (at least you'll need node)
npm install -g azure-cli azure login azure config mode arm
or asm, depends on your virtual machine
azure vm list
change mode if no VM is specified
copy the sudoers file from another computer to /tmp/sudoers.default on your target machine.
standby sudoers
azure vm extension set hm hm CustomScript Microsoft.Azure.Extensions 2.0 --auto-upgrade-minor-version -i '{"commandToExecute": "cp /etc/sudoers /tmp"}'
copy default sudoers to / etc / sudoers
azure vm extension set hm hm CustomScript Microsoft.Azure.Extensions 2.0 --auto-upgrade-minor-version -i '{"commandToExecute": "cp /tmp/sudoers.default /etc/sudoers"}'
source share