Description:

This script should be used in conjunction with the Windows Azure PowerShell cmdlets to enable secure Remote PowerShell connectivity to a virtual machine created in Windows Azure.

The script accepts the Subcription Name, the Windows Azure cloud service that hosts the virtual machine and the virtual machine name. It connects, retrieves the thumbprint for the certificate and downloads that specific certificate to the local machine. Once downloaded it installs the certificate into the local machines certificate store.

Note: To execute the script PowerShell must run elevated.

 

Usage:

 

 

PowerShell
Edit|Remove
.\InstallWinRMCertAzureVM.ps1 -SubscriptionName $subName -ServiceName $cloudService -Name $vmName 
 
 
# Return back the correct URI for Remote PowerShell  
$uri = Get-AzureWinRMUri -ServiceName $cloudService -Name $vmName 
 
# Credentials for the VM 
$cred = Get-Credential  
 
# Open a New Remote PowerShell Session 
Enter-PSSession -ConnectionUri $uri -Credential $cred