Azure-runbook中的New-PSSession:访问被拒绝(ARM) [英] New-PSSession in an Azure-runbook: Access denied (ARM)
问题描述
使用中提供的建议,我能够在Azure VM(1)上设置winrm
.
With the advice provided in this answer I was able to set up the winrm
on a Azure VM(1).
现在,我可以使用
- 任何Azure VM(2)到Azure VM(1)
- 将我的本地计算机连接到Azure VM(1)
但是,如果我在Azure Runbook中执行完全相同的操作,
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]连接到远程服务器 xxx.yyy.cloudapp.azure.com失败,并显示以下错误消息:访问被拒绝.
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.
作为用户,我使用`localhost \ admin,并且我是positiv,密码正确(仔细检查了密码).
As user I use `localhost\admin" and I'm positiv, the password is correct (double-checked it).
Q 如何克服拒绝访问?
更新
PS工作流程让我受益匪浅.因此,以上代码中仅存在一个较小的语法问题.如果有人分享正确的答案,我很乐意投票并接受.
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.