Jump to content
Sign in to follow this  
  • entries
    141
  • comments
    0
  • views
    78578

Azure VM CMD & PowerShell from the Portal

Sign in to follow this  
proximagr

106 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”
img_5cf8e39a648d0.png
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.
img_5cf8e48b97951.png
Using the i command we can get the IP Address configuration of the VM
img_5cf8ed949b92a.png Command Prompt
To create a command prompt session, first enter “cmd”. This will create a session.
img_5cf8eeff4cfd2.png
To list the cmd sessions press “ch”
img_5cf8ef7f2c554.png
to select & login to a cmd session press “ch -si #” where # is the channel number. At the below screen press Enter
img_5cf8efabaceb2.png
At the next screen enter the admin credentials
img_5cf8f03ed1b86.png
and we have Command Prompt. At this command prompt we can use all cmd commands.
img_5cf8f061d3edb.png
Some examples:
ping -t
img_5cf8f0d3a60f8.png
dir
img_5cf8f0fb8e7c6.png PowerShell
at the command prompt enter “powershell” and press Enter to open a PowerShell Session
img_5cf8f14e24299.png
PowerShell example, disable windows firewall:
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
img_5cf8f34463a54.png
and yes, its off
img_5cf8f3609d243.png
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.microsoft.com/en-us/azure/virtual-machines/troubleshooting/serial-console-cmd-ps-commands

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...