繁体   English   中英

无法使用Powershell远程连接到Azure VM

[英]Unable to connect to Azure VM remotely using powershell

我已经使用powershell创建了Azure VM。 这是我使用的脚本。

$UserName = "admin"
$Password = ConvertTo-SecureString "admin@123" -AsPlainText -Force
$psCred = New-Object System.Management.Automation.PSCredential($UserName, $Password)    
New-AzureRmVm `
    -ResourceGroupName "RGN" `
    -Name "VName" `
    -ImageName "Imagename" `
    -Location "West US" `
    -VirtualNetworkName "Vnetname" `
    -SubnetName "default" `
    -Credential $psCred `
    -OpenPorts 3389

现在,我正在尝试与此虚拟机通信。 这是我用来建立连接/会话的命令。

$UserName = "admin"
$Password = ConvertTo-SecureString "admin@123" -AsPlainText -Force
$psCred = New-Object System.Management.Automation.PSCredential($UserName, $Password)
$s = New-PSSession -ComputerName VName -Credential $psCred

就是说用户名或密码不正确,谁能解释我在做什么错,谢谢!

我要使用的是“ domain \\ admin”或“ computer \\ admin”,也可以在此通过该线程上的步骤。 https://github.com/Azure/azure-powershell/issues/1309

您可以在Azure门户上添加要连接的VM的规则。 然后在vm中配置WINRM。 在您的PC中添加可信IP。

有关更多详细信息,请参见通过Powershell访问Azure Windows VM

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM