-1

I was trying to enable winRm from terraform. But winRM additional settings like

winrm set winrm/config/service @{AllowUnencrypted="true"} 
winrm set winrm/config/service/auth @{Basic="true"} 

are not able to add properly in tf file.

Charles Xu
  • 24,004
  • 1
  • 12
  • 27

2 Answers2

1

You're just missing the quotes. Replace your line:

winrm set winrm/config/service `@{AllowUnencrypted="true"}

With this line instead:

winrm set winrm/config/service '@{AllowUnencrypted="true"}'
Jeremy Caney
  • 4,585
  • 13
  • 32
  • 54
0

To enable the WinRM in the Azure Windows VM, I would suggest you use the VM extension. You can create a PowerShell script to enable WinRM and execute it in the VM extension.

You can see the steps of Setting up WinRM access for Virtual Machines and How to configure the VM to enable WinRM through PowerShell script.

Charles Xu
  • 24,004
  • 1
  • 12
  • 27
  • I want to run the powershell script during the terraform azure vm creation step and want to execute some powershell scripts in the newly created machine in automated way without any manual operation. Could you please help me to configure the winrm in terraform execution step. I was able to enable the winrm using below commands in terraform. os_profile_windows_config { winrm { protocol = "HTTP" } – Alan GEORGE May 24 '19 at 06:03
  • @AlanGEORGE As I said in the answer. You can use the VM extension. Take a look at the [example](https://jackstromberg.com/2018/11/using-terraform-with-azure-vm-extensions/). – Charles Xu May 24 '19 at 06:27