Azure Linux Login using Azure AD.

Hello All,

On today scenario i will demonstrate how to login to your Linux VM using Azure AD.

This will allow you to use your Azure AD to manage identity’s instead of creating new users locally each time you provision a Linux VM.

So in my Demo here i have created an Ubuntu 18.04 VM Size Standard D2s v3 (2 vcpus, 8 GiB memory) at North Europe.

VM Name : Ubuntu18
Resource Group Name : Unbuntu18AAD

Then i have opened the Cloud Shell on the Top right corner in a Bash shell.

Then i have installed the AAD Extention using the below Az Cli:

tzachi@Azure:~$ az vm extension set –publisher Microsoft.Azure.ActiveDirectory.LinuxSSH –name AADLoginForLinux –resource-group Unbuntu18AAD –vm-name ubuntu18

For Convince i have enter two variables with data.

username=$(az account show –query –output tsv)
vm=$(az vm show –resource-group Unbuntu18AAD –name ubuntu18 –query id -o tsv)

Once i set this i have set the proper role assiment with permission “Virtual Machine Administrator Login”

az role assignment create –role “Virtual Machine Administrator Login” –assignee $username –scope $vm

once the above is complete open your favorite ssh tool .

tzachie@tzachie-p1:~$ ssh -l

This will promoted you for an AAD Authentication as shown below.

This will required an authentication by entering the one time generated Code into the page below

Once you get confirmaiton of your login

you will need to press Enter on your ssh prompt to complete login.

Remember if you face any issue Feel free to raise a ticket to our wonderfully Azure support and an engineer will be happy to assist mitigate the issue.

Thank you , Tzachi Elkabatz

Close Bitnami banner