问题
I cloned a Windows Server 2012 R2 VM from a VM image. I can:
- Log in with Remote Desktop.
- Browse to IIS on port 80 from the Internet.
- 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.
回答1:
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).
回答2:
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.
来源:https://stackoverflow.com/questions/36061088/unable-to-connect-to-vm-with-azure-certified-test-tool-1-2