简体   繁体   English

无法在Azure自动化混合工作器上运行远程会话

[英]Cannot run remote session on Azure Automation hybrid worker

I have a Powershell Azure Automation runbook that remotes into a machine to update some configuration. 我有一台Powershell Azure自动化运行手册,该手册可以远程访问计算机以更新某些配置。 The runbook seems to work properly when run from Azure, but fails with an authentication error when run from a Hybrid Worker. 从Azure运行时,该运行簿似乎正常工作,但是从Hybrid Worker运行时,运行簿失败并出现身份验证错误。

The whole reason for having the Hybrid Worker was so I could secure the PSRemoting ports to known hosts, so this is a bit of a bummer. 拥有Hybrid Worker的全部原因是为了使我可以将PSRemoting端口保护到已知主机,因此这实在太可惜了。

The main runbook is triggered via webhook, and that calls a child runbook using dot-notation, which calls... 主Runbook通过Webhook触发,并使用点符号调用子Runbook,该子Runbook调用...

$creds = Get-AutomationPSCredential -Name 'DeploymentCredentials'
$sessionOptions = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck
Invoke-Command -ConnectionUri "https://$($FQDN):5986" -Credential $creds -SessionOption $sessionOptions -ScriptBlock {
    $h = hostname
    Write-Output "Running on $h"
}

In this case, $FQDN is supplied as a parameter of course. 在这种情况下,当然会提供$FQDN作为参数。

The error being reported is: 报告的错误是:

Connecting to remote server my-server.australiaeast.cloudapp.azure.com failed with the following error message : Access is denied. 连接到远程服务器my-server.australiaeast.cloudapp.azure.com失败,并显示以下错误消息:拒绝访问。 For more information, see the about_Remote_Troubleshooting Help topic. 有关更多信息,请参见about_Remote_Troubleshooting帮助主题。

  • CategoryInfo : OpenError: (my-server.au...udapp.azure.com:String) [], PSRemotingTransportException CategoryInfo:OpenError:(my-server.au ... udapp.azure.com:String)[],PSRemotingTransportException

  • FullyQualifiedErrorId : AccessDenied,PSSessionStateBroken FullyQualifiedErrorId:AccessDenied,PSSessionStateBroken

I can manually execute the same code from ISE without issue from the hybrid worker so I know it's not a firewall issue, and I have the credentials writing to the output window so I know they are correct too. 我可以从ISE手动执行相同的代码,而没有混合工作程序发出的消息,因此我知道这不是防火墙问题,而且我将凭据写入输出窗口,因此我也知道它们也是正确的。

I presume this is something to do with the fact the PowerShell function executes under the system account? 我认为这与PowerShell函数在系统帐户下执行的事实有关吗?

Thx 谢谢

Answering my own question for posterity. 回答我关于后代的问题。

Altering the Hybrid Worker Group to run using credentials for a machine admin allowed the setup to work; 更改Hybrid Worker组以使用机器管理员的凭据运行可以使设置生效; where using the "Default" credentials (System account I believe) did not. 没有使用“默认”凭据(我相信系统帐户)的位置。

I think in Windows the System account is not allowed to connect to other machines/services so this may be why, but I'm guessing there. 我认为在Windows中,系统帐户不允许连接到其他计算机/服务,所以这可能就是原因,但是我猜在那里。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用 Azure Automation 在 Hybrid Worker 上运行浏览器自动化 - Can not run browser automation with head on hybrid worker using Azure Automation 如何从 PowerShell 为 Azure 自动化运行手册创建自动化计划以在混合工作器上运行? - How to create automation schedule for Azure Automation Runbook from PowerShell to be run on Hybrid Worker? Microsoft Azure:Automation Hybrid Worker 能否用于针对不同帐户/订阅的计算机运行脚本? - Microsoft Azure : Can Automation Hybrid Worker be used to run scripts against computers on different accounts/subscriptions? 适用于 PowerShell 7 的 Azure 自动化混合工作者 Get-AutomationPSCredential - Azure Automation Hybrid-Worker Get-AutomationPSCredential for PowerShell 7 如何将VM添加到多个Azure Automation Hybrid Worker组 - How to add a vm to multiple azure automation hybrid worker group 有没有办法从 Azure 自动化帐户中的混合工作人员组中删除陈旧的机器工作人员? - Is there a way to delete a stale machine worker from a Hybrid Worker Group in Azure automation account? Azure 自动化混合本地 Linux 工人不会接受工作 - Azure Automation Hybrid On-Prem Linux Worker won't accept jobs Azure自动化在Hybrid Worker上调用内部应用程序Rest API返回400错误 - Azure Automation calling an interal application Rest API on a Hybrid Worker returning a 400 error 使用来自 Azure 的 Get-VICredentialStoreItem 的 vCenter 登录失败 - vCenter logon failing using Get-VICredentialStoreItem from Azure automation runbooking with hybrid worker 天蓝色的远程桌面看不到工作角色 - azure remote desktop cannot see worker role
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM