For an Azure VM in the classic portal (ASM) I was able to obtain
- the required credentials with
Get-AutomationPSCredential
and - the
-ConnectionURI
withConnect-AzureVM.ps1
.
With these two parameters I was able to successfully execute a New-PSSession
in an Azure-runbook.
Q What am I supposed to do to open a PS-Session in an Azure-runbook to an Azure-VM (ARM)?
Update
command in runbook (ARM)
$vmSession = New-PSSession -ConnectionUri 'https://xxx.yyy.cloudapp.azure.com:5985' -Credential $creds -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck)
error-message
New-PSSession : [xxx.yyy.cloudapp.azure.com] Connecting to remote server xxx.yyy.cloudapp.azure.com failed with the following error message : WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.