Azure Automation runbook was not working with remote PS

Manikanta Puppala 21 Reputation points
2022-10-26T17:23:28.993+00:00

Dear Team,

Azure automation runbook was not working with remote PS, please find the below code for reference,

$Vm = "https://X.X.X.X:5986/WSMAN"
$so = New-PSSessionOption -SkipCACheck -SkipCNCheck
$rmSession = New-PSSession -ConnectionUri $Vm -SessionOption $so -CertificateThumbprint XXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Error Message,

[X.X.X.X] Connecting to remote server X.X.X.X 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.

I have uploaded the required certificate under the automation account too, The same code was working from my local machine.

It would be great if any solution is provided here.

Note: This was not a Hybrid Runbook

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,235 questions
0 comments No comments
{count} votes

Accepted answer
  1. Maxim Sergeev 6,571 Reputation points Microsoft Employee
    2022-10-26T18:04:05.193+00:00

    Azure Automation Account Sandbox is a public-faced service. It's not configurable to work with custom certificates for authorization.

    Only for using the certificate for the runbook\script itself.

    If you need to authenticate your PS session, it requires to run your PS sessions on hybrid worker servers.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.