How to run puppet bolt command remotely on Azure Virtual Machine through powershell

做~自己de王妃 提交于 2020-04-18 00:55:11

问题


I'm trying to run below puppet bolt command for remote Azure VM through powershell.

bolt command run ipconfig --targets winrm://158.28.0.546 --no-ssl -user testuser123 -password test@84p

getting below error for above command in powershell

Failed on 192.168.0.140:

Timeout after 10 seconds connecting to 192.168.0.140

Failed on 1 target: 192.168.0.140

How to resolve above issue

Update 1:

WinRM enabled on remote Azure Virtual Machine. Even Firewall is disabled on Azure VM for public networks.

After adding DNS name in Azure Portal, I'm getting error as below

Failed to connect to https://testazurevm.westus.cloudapp.azure.com:5986/wsman:

No connection could be made because target machine actively refused it


回答1:


For this issue, the error shows a timeout after trying to connect. Generally, it is because the port does not allow you to connect. And there should be two reasons as I know. One is that the firewall does not allow access from the port. Another is that the port does not be listened to.

For you, you can check if the firewall allows the WinRM port and if the WinRM is enabled in the VM.




回答2:


Issue fixed after following below steps as given in below article.

https://docs.microsoft.com/en-us/azure/marketplace/cloud-partner-portal/virtual-machine/cpp-configure-winrm-after-vm-creation

  1. Navigate to the blade Virtual machines > > Settings/Networking.
  2. Click on the NSG name to display its properties: Under Settings, select Inbound security rules to display this blade.
  3. Click +Add to create a new rule called WinRM_HTTPS for TCP port 5986.
  4. Click OK when you are finished supplying values.

Configure VM to enable WinRM:

Download and copy below to remote machine. (Get these files from link provided.)

  • ConfigureWinRM.ps1
  • makecert.exe
  • winrmconf.cmd

Run below command in remote vm.

ConfigureWinRM.ps1 <vm-domain-name>


来源:https://stackoverflow.com/questions/60956833/how-to-run-puppet-bolt-command-remotely-on-azure-virtual-machine-through-powersh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!