When you create the virtual machine and upload your own keys it will copy these to the user you created and to root under /home/user/.ssh/authorized_keys and /root/.ssh/authorlized_keys. The first part of the root authorized_key before ssh-rsa needs to be removed as Chris said.
# Create your key pair, in *nix use
ssh-keygen
# Get the public key
cat ~/.ssh/id_rsa.pub
# Paste the first 2 fields into the upload public key box when creating the azure vm but remove the user@yourlocalhost note at the end or azure will give you an error.
# Finish creating the vm and get the azure_vm_public_ip
# Connect to vm
ssh username@azure_vm_ip_address
# reset root password
sudo passwd root
# check sudoers
sudo visudo
# add user to any groups you want
sudo usermod -a -G admin,sudo,www-data username
# become root
su - root
# reset user password
passwd username
# edit sshd configuration
nano /etc/ssh/sshd_config
# uncomment this
PermitRootLogin prohibit-password
# edit /root/etc/.ssh/authorilized_keys and remove everything before ssh-rsa, the code before ssh-rsa is the part that blocks root login.
# restart sshd
systemctl restart ssh
# or the old way to reload sshd
ps -ax | grep sshd
943 ? Ss 0:00 sshd: /usr/sbin/sshd -D [listener]
kill -1 943
# You can now login directly as root.
I highly advise anyone who does this to modify the azure rules to only permit their own remote ip's and subnets to access port 22 or what ever you choose to use for your ssh port... and the rdp port if you install xrdp. This will cut down on the volume of people who can attack the port. Azure will suggest you do this under security recommendations.
Also, it won't provide security against intensive port scans but it will help reduce simple login attempts if you change your ssh port by editing /etc/ssh/sshd_config with something like Port 33322 and restart sshd again. Then login with
ssh root@host -p 33322.
Logging in with ssh keys is considered fairly secure as long as your private key is not compromised. I am a bad system admin and have been using root account for 30 years. The main drawback to using root is you can accidentally delete something by accident and installing programs with elevated privs can over write system files and break your system. In theory if people have backdoors into the programs you run as root they can get root privs.
sjohn