papsl
8/17/2015 - 12:06 PM

Azure - Open PowerShell session to Azure Virtual Machine (complete with publish settings)

Azure - Open PowerShell session to Azure Virtual Machine (complete with publish settings)

#Download file
Get-AzurePublishSettingsFile 

#Import Publishing file
Import-AzurePublishSettingsFile -PublishSettingsFile "publishsettingsfile.publishsettings"

#List all profiles
Get-AzureSubscription

#Select active AzureSubscription
Select-AzureSubscription "Visual Studio Premium with MSDN"

# Start machine
Start-AzureVM -Service "ServiceName" -Name "ServerName"

# Open PowerShell command session to VM
Enter-PSSession -ConnectionUri (Get-AzureWinRMUri) -SessionOption (New-PSSessionOption -SkipCACheck) -Credential (Get-Credential)