This post was originally published here
I usually use a range of different usernames to define as the administrator of my Azure Virtual Machines, and I have others that clients shared with me. So, you may be thinking, why are you accessing the Azure VM’s using the administration account and not an AD account? Typically, these are standalone development environments where I need permissions as administrator, so sometimes, this is the quick and easy way. We may argue if this is the best practice or not, but it is without a dought the fastest and easy way.
And today, one of my team members called me asking what was the password of user ABC (not the real username name) to access one of our Azure BizTalk Server Development VM’s because he was trying all possible variants and it was not able to log in. Unfortunately, I don’t remember all the VM administrator usernames I use to create our internal VM, so the first question I asked was not about the password but if he was using the correct username to access the machine. He was not sure about it neither.
So, the main question is: How can you quickly find the Azure VM administrator username of a specific machine?
There maybe be many ways to find this information. I will highlight here two of them that I normally use.
Option 1: Using the Azure Portal
- Go to Virtual Machines services on your Azure portal.
- Select the Virtual Machine that you want to find the username.
- On the Virtual Machine property page, from the option tree, click on the Run command option from the Operations section.
- On the Run command page, select RunPowerShellScript and them type Get-LocalUser on the PowerShell Script panel and click Run
- The output will be a list of local user present on the machine mentioning what is the administrator.
Option 2: Using PowerShell
Another easy option is using a simple PowerShell script:
Get-AZVM -Name VM-NAME | Select-Object -ExpandProperty OSProfileThe output of that command will have the Administration username of that VM:
Download
THIS POWERSHELL SCRIPT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
You can download Finding Azure VM Administrator Username from GitHub here:
The post Azure Breakthroughs: Finding the Azure VM administrator username appeared first on SANDRO PEREIRA BIZTALK BLOG.