With the advice provided in this answer I was able to set up the winrm
on a Azure VM(1).
Right now, I can open a PS-Session with New-PSSession
from
- any Azure VM(2) to the Azure VM(1)
- my local machine which to the Azure VM(1)
But if I do exactly the same within an Azure runbook,
$cred = Get-AutomationPSCredential -Name "admin"
InlineScript
{
$vmSession = New-PSSession -ConnectionUri 'https://xxx.yyy.cloudapp.azure.com:5986' -Credential $cred -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck)
}
it fails with the error message:
New-PSSession : [xxx.yyy.cloudapp.azure.com] Connecting to remote server xxx.yyy.cloudapp.azure.com failed with the following error message : Access is denied.
As user I use `localhost\admin" and I'm positiv, the password is correct (double-checked it).
Q How can I overcome the Access denied?
Update
PS-workflow got the best of me. So, there is only a minor syntactical problem in the code above. If somebody shares the right answer I'm happy to up-vote and accept it.
According to this official documents.
So, you need modify your script as below: