【发布时间】:2016-07-25 02:36:05
【问题描述】:
我在资源管理器中有虚拟机,我想从这些虚拟机的运行手册中执行远程 PowerShell 脚本。我已经知道如何在经典虚拟机中做到这一点并成功使用。
现在,是否在使用 Azure 资源管理器创建的 Azure VM 上默认启用了证书的远程 PowerShell over SSL?如何连接 Enter-PSSession 或 Invoke-Command?
我试过这段代码没有成功。
Enter-PSSession -ComputerName <public-IP> -Credential $cred -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck)
我得到了这个错误
Enter-PSSession : Connecting to remote server <public-IP> failed with the following error message : The WinRM client
cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not
joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts
configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not
be authenticated. You can get more information about that by running the following command: winrm help config. For more
information, see the about_Remote_Troubleshooting Help topic.
注意:我在 Azure 自动化中使用 Powershell Runbook 运行它。 并尝试了建议的答案here
【问题讨论】:
-
使用 HTTPS 配置您的 VM 远程 PowerShell,然后重试。你应该有
Transport = HTTPS和Port = 5986。 -
@JackZeng 已经这样做了 ='( 但远程处理仍然没有成功
标签: powershell azure azure-resource-manager azure-automation runbook