Categories: AzureEnglish

Connecting to a Windows Azure VM in Remote PowerShell

Accessing to you virtual machine is easy when you just need a RDP connection.

But, you may want to connect to you Azure virtual machine thanks to Remote PowerShell.

Part  1 – Accessing to a Azure Virtual Machine by Remote PowerShell

When you want to access to a remote VM thanks to PowerShell, you can do this with standard PowerShell prompt or with the improved prompt called « Windows PowerShell ISE ».

When you open, Windows PowerShell ISE, you can reach in the top menu and select New Remote PowerShell Tab.

On the next window, you can specify the name or public IP address of your virtual machine and the login that you want to use and press Connect. It will ask you for you password of the specify account.

If you want to do the same with the standard PowerShell prompt. You can use the following CmdLet :


Enter-PSSession -ComputerName yourvm.cloudapp.net -Credential login

You can also precise the parameter -Port XXXX if you don’t use a standard port number. To check the public port for Remote PowerShell on Windows Azure, you can go in the parameters of your virtual machine then in « Terminaison points » you will get the port number. By default, it’s 5986.

If you tried the 2 previous possibilities to connect yourself to a Azure virtual machine. You may encounter some errors.

Part 2 – Troubleshooting

We will assume you have already created a VM in order to test the next steps.

To make the connection works, you just need to get the certificate of you Azure Virtual Machine and use SSL connection when you Enter-PSSession CmdLet.

First, the more difficult way, you reach the web URL of your virtual machine. My VM is called « akril » so it’s name will be by default :

  • https://akril.cloudapp.net:5986/

On Chrome, you can click on the lock at the left of the URL to get more information about this certificate…

Copy the certificate on your desktop and install it under Trusted Root Certification Authorities.

The certificate is correctly installed, you can now launch the following command to connect to your virtual machine :


Enter-PSSession -ComputerName yourvm.cloudapp.net -Credential login -UseSSL

You are not successfully connected to your virtual machine in PowerShell !

Original article from Fabric Controller.

Part 3 – Remove the certificate

If you want to remove the certificate for any reasons, you just have to start a mmc.exe console. Add the snap-in Certificates and you will find your certificate here.

Just right-click on it ant select Delete.

Share
Published by
thibault

Recent Posts

Adieu à l’Écran Bleu : Microsoft Réinvente l’Expérience Utilisateur après 40 Ans

Adieu à l'Écran Bleu : Microsoft Réinvente l'Expérience Utilisateur après 40 Ans L'écran bleu, symbole…

1 jour ago

Sortir du cloud Azure : L’Europe se tourne-t-elle vers OVH ?

Sortir du cloud Azure : L'Europe se tourne-t-elle vers OVH ? Sortir du cloud Azure…

2 jours ago

OneDrive : Quand Microsoft Verrouille un Compte, 30 Ans de Fichiers Perdus

OneDrive : Quand Microsoft Verrouille un Compte, 30 Ans de Fichiers Personnels Perdus OneDrive, le…

3 jours ago

Télétravail : La Société Générale Réduit à 1 Jour par Semaine, une Tendance IT ?

Télétravail : La Société Générale Réduit à 1 Jour par Semaine, une Tendance IT ?…

6 jours ago

Lyon et la Souveraineté Technologique : Pourquoi les Écologistes Abandonnent Microsoft

Lyon et la Souveraineté Technologique : Pourquoi les Écologistes Abandonnent Microsoft Lyon, célèbre pour sa…

6 jours ago

Automatiser la création d’articles dans WordPress avec ChatGPT et Zapier

Automatiser la création d’articles dans WordPress avec ChatGPT et Zapier Aujourd'hui les innovations autour de…

1 semaine ago