First, you need to install Azure PowerShell
Go to the Azure Downloads page and click the link to install the Azure PowerShell cmdlets.
Step 1: Get-AzureVM to find out all your VMs hosted on Azure. In my case i have one VM for AX2012 which was deployed through LCS
Make sure to copy ServiceName and Name
Step 2: How to start
Syntax: Start-AzureVM -ServiceName “AX2012R3-Demo-Demo-da16992830bbf75a” -Name “DEMO-41e1aa3f1f”
Refresh Azure Portal > VM > Status , you will see eventually the status will become “Running”
Step 3: How to stop
Syntax: Stop-AzureVM -ServiceName “AX2012R3-Demo-Demo-da16992830bbf75a” -Name “DEMO-41e1aa3f1f” -Force
Bonus:
How to get RDP file
Syntax: Get-AzureRemoteDesktopFile -ServiceName “AX2012R3-Demo-Demo-da16992830bbf75a” -Name “DEMO-41e1aa3f1f” -LocalPath “c:\temp\AzureAX.rdp”
How to launch RDP from command line directly
Syntax: Get-AzureRemoteDesktopFile -ServiceName $serviceName -Name $vmName –Launch
A session will pop up and prompt to connect to the VM
How to delete a virtual machine
Syntax: Remove-AzureVM -ServiceName “AX2012R3-Demo-Demo-da16992830bbf75a” -Name “DEMO-41e1aa3f1f” –DeleteVHD