Quantcast
Channel: Azure Virtual Machines forum
Viewing all articles
Browse latest Browse all 12545

[Forum FAQ] How to use Windows PowerShell Remoting for Windows Azure Virtual Machines

$
0
0

Instead of using RDP to connect to the VMs on Windows Azure, we can use the PowerShell Remoting to manage the systems.


about_Remote

http://technet.microsoft.com/en-us/library/hh847900.aspx


Enable and Use Remote Commands in Windows PowerShell

http://technet.microsoft.com/en-us/magazine/ff700227.aspx


Step 1: Install Windows Azure PowerShell


Please refer to the article below to install Windows Azure PowerShell.


How to install and configure Azure PowerShell

http://azure.microsoft.com/en-us/documentation/articles/install-configure-powershell/


Open the Azure PowerShell console, type Add-AzureAccount, type the email address and password associated with your account.


Azure will authenticate and save the credential information.


Step 2: Enable Remote PowerShell


After creating the Virtual Machine (from the gallery), the Remote Desktop and Windows PowerShell Remoting Endpoints are created by default. Go to the Endpoint tab, we’ll see port numbers to the Remote PowerShell port. In this demo, it is port 5986. (Figure 1)


 

Figure 1


Step 3: Connect the Virtual Machine using Enter-PSSession command


Enter-PSSession -ComputerName v-cloud.cloudapp.net -Port 5986 -UseSSL –Credential (Get-Credential)


You need to type the User name and Password. (Figure 2)



Figure 2


When trying to connect, we will see the following error: (Figure 3)


Enter-PSSession: Connection to remote server v-cloud.cloudapp.net failed with the following error message: The server certificate on this destination computer (v-cloud.cloudapp.net:5986) has the following errors:

The SSL certificate is signed by an unknown certificate authority.



Figure 3


It is due to PowerShell Remoting using Https and the certificate used for the virtual Machine is a self-signed certificate. To solve this issue, we need to access the Virtual Machine and tis public endpoint for PowerShell Remoting.  We should add the special certificate to Trusted Root Certification Authorities.


Steps:


1) Connecting to the Virtual Machine via RDP and open MMC console.

2) File -> Add/Remove span-ins, choose certificates, click add.

3) In Certificates snap-in, choose computer account, click next.

4) We could find the certificate we need under the Personal folder. (Figure 4)


Capture4

Figure 4


5) Export this certificate to the location you want to save, then copy it to the local computer.

6) Double click the certificate file -> Install it under "Current User" -> "Trusted Root Certification Authorities".


Step 4: Using Remote PowerShell


After step 1-3, re-execute the Enter-PSSession command and we should able to access the VMs via PowerShell Remoting. (Figure 5)


Figure 5


Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.


Viewing all articles
Browse latest Browse all 12545

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>