0
votes

I have created a new Windows 2012 image in Azure and have configured WinRM with the following commands:

winrm quickconfig -q
winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}
winrm set winrm/config @{MaxTimeoutms="1800000"}

I am attempting to bootstrap the vm using knife:

knife bootstrap mymachine.cloudapp.net x username -P password "mymachine"

The error returned is: ERROR: Network Error: No connection could be made because the target machine actively refused it. - connect(2)
Check your knife configuration and network settings

I have enabled an endpoint in Azure for the following (public ports):

PowerShell 5985
SSH 22
WinRM 2985

Any help would be appreciated.

2

2 Answers

1
votes

I have resolved the problem and it was due to the command I was using to bootstrap the image.

knife bootstrap windows winrm grussblank.cloudapp.net -r "role[myrole]" -x username -P "password"

I was missing "windows winrm" which might have been important! :)

0
votes

For testing and development purposes, you can follow the instructions at docs.opscode.com/plugin_knife_windows.html and set the following additional winrm options on the remote system using PowerShell or the winrm config tool -- here's a PowerShell example of setting these options:

si WSMan:\localhost\Service\AllowUnencrypted $true
si WSMan:\localhost\Service\Auth\Basic $true

For production (not internal dev / test) use, the solution above should not be used, an issue being tracked at https://tickets.opscode.com/browse/KNIFE-298.

A workaround for production use is to use Azure's resource extension capability, which supports Chef -- here's information on how to do this through the portal:

http://docs.opscode.com/azure_portal.html

This can also be configured through the Azure SDK tools in the cli rather than the portal using PowerShell via Set-AzureVMExtension.