Created
January 8, 2015 19:33
-
-
Save pcgeek86/9df3866406c66006f17e to your computer and use it in GitHub Desktop.
A helper function to connect to Microsoft Azure virtual machines using PowerShell Remoting. Visit http://trevorsullivan.net.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Enter-AzurePSSession { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true)] | |
[string] $ServiceName, | |
[Parameter(Mandatory = $true)] | |
[string] $VMName | |
) | |
$SessionOption = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck; | |
$WinRMUri = Get-AzureWinRMUri -ServiceName $ServiceName -Name $VMName; | |
$VMCredential = Get-Credential; | |
Enter-PSSession -ConnectionUri $WinRMUri -SessionOption $SessionOption -Credential $VMCredential; | |
} | |
Enter-AzurePSSession pcgeek101101 trevor03; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment