Using a Linux based Azure VM you may need to access the console to do special operations and VM Azure Extensions are the right tool to do it.
This is expecially true when you do something really weird like, such as putting file in /etc/sudoers.d folder without checking it beforehand with visudo. If the file is not 100% perfect you can loose the entire VM and there isn't much you can do to recover it since all the privileged action are locked down by the error in the file that is included in the sudoers file.
One possible solution is to use a VM Extensions called "Custom Script for Linux"
In my case, it was super-useful to run a script with elevated rights that deleted the faulty file from /etc/sudoers.d to solve a mess.
Remember that, since it can download very complicated scripts from your computer (or many other sources) ) to your VM, we can easily say that "the sky is the limit" 🙂
You can read here all the details on how to use this extension.