Unable to connect to VM with Azure Certified Test

2019-09-05 18:05发布

I cloned a Windows Server 2012 R2 VM from a VM image. I can:

  1. Log in with Remote Desktop.
  2. Browse to IIS on port 80 from the Internet.
  3. Verify WinRM connectivity with Powershell: "Test-WSMan -ComputerName xyz.westus.cloudapp.azure.com"

When I press the connect button in the test tool, the following error is logged:

Error in connecting to the VM. Reason for not connecting to the VM : System.Management.Automation.Remoting.PSRemotingTransportException: Connecting to remote server xyz.westus.cloudapp.azure.com 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. at System.Management.Automation.Runspaces.AsyncResult.EndInvoke() at System.Management.Automation.Runspaces.Internal.RunspacePoolInternal.EndOpen(IAsyncResult asyncResult) at System.Management.Automation.Runspaces.Internal.RemoteRunspacePoolInternal.Open() at System.Management.Automation.RemoteRunspace.Open() at WindowsAddin.PSConnection.OpenSession()

What can I change to make the connect action succeed?

Edit: I also ran the Azure quickstart template to configure WinRM. The output was:

PS C:\Users\hans\Downloads\201-vm-winrm-windows> .\ConfigureWinRM.ps1

cmdlet ConfigureWinRM.ps1 at command pipeline position 1

Supply values for the following parameters: HostName: xyz.westus.cloudapp.azure.com

Deleted 1 rule(s).

Ok.

Ok.

Unfortunately, the error message logged is still the same.

2条回答
姐就是有狂的资本
2楼-- · 2019-09-05 18:49

WinRM is not enabled by default in Azure Resource Manager virtual machines. To enable it you can use the scripts in this quickstart template. Execute the powerhsell scirpt (make sure to copy ConfigureWinRM.ps1, makecert.exe and makecert.exe to the VM).

查看更多
女痞
3楼-- · 2019-09-05 19:01

Error is clear that "By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet." So you need to add a firewall exception. That's all.

Good luck & hope that helps.

查看更多
登录 后发表回答