Jump to content

- - - - -

Azure VM CMD & PowerShell from the Portal

  Posted by Pantelis Apostolidis , in Azure 06 June 2019 · 51 views

Azure VM CMD & PowerShell from the Portal
Today I was trying to troubleshoot an Azure VM. This VM is behind a Network Virtual Appliance (NVA) and at the subnet it has User Defined Routes (UDR) that routes the traffic to the NVA. We was troubleshooting the NVA and it was not possible to connect with RDP to the VM.
Serial Console
This is an excellent scenario to use the Serial Console. From the Azure Portal, portal.azure.com, navigate to the Azure VMs blade, scroll down to the Support + Troubleshooting section and select “Serial Console”

Posted Image

The Serial Console will initialise and after a while it will establish the connection and the prompt will be the SAC>. If you encounter any errors establishing the SAC link, please follow this link: https://aka.ms/serialconsolewindows

At the SAC> prompt press help to list the available commands.

Posted Image

Using the i command we can get the IP Address configuration of the VM

Posted Image
Command Prompt
To create a command prompt session, first enter “cmd”. This will create a session.

Posted Image

To list the cmd sessions press “ch”

Posted Image

to select & login to a cmd session press “ch -si #” where # is the channel number. At the below screen press Enter

Posted Image

At the next screen enter the admin credentials

Posted Image

and we have Command Prompt. At this command prompt we can use all cmd commands.

Posted Image

Some examples:

ping -t

Posted Image


Posted Image
at the command prompt enter “powershell” and press Enter to open a PowerShell Session


PowerShell example, disable windows firewall:

Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False


and yes, its off


of course, for the firewall we could disable it using CMD

netsh advfirewall set allprofiles state off

For more example commands follow this link: https://docs.microso...cmd-ps-commands