【问题标题】:How to setup winrm AllowUnencrypted="true" and auth @{Basic="true"} in terraform如何在 terraform 中设置 winrm AllowUnencrypted="true" 和 auth @{Basic="true"}
【发布时间】:2023-03-10 14:03:01
【问题描述】:

我试图从 terraform 启用 winRm。但是 winRM 的附加设置比如

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

无法在 tf 文件中正确添加。

【问题讨论】:

    标签: azure terraform winrm


    【解决方案1】:

    您只是缺少引号。替换你的行:

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

    改用这一行:

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

    【讨论】:

      【解决方案2】:

      要在 Azure Windows VM 中启用 WinRM,我建议您使用 VM 扩展。您可以创建一个 PowerShell 脚本来启用 WinRM 并在 VM 扩展中执行它。

      你可以看到Setting up WinRM access for Virtual MachinesHow to configure the VM to enable WinRM through PowerShell script的步骤。

      【讨论】:

      • 我想在 terraform azure vm 创建步骤中运行 powershell 脚本,并希望在新创建的机器中以自动化方式执行一些 powershell 脚本,而无需任何手动操作。您能否帮我在 terraform 执行步骤中配置 winrm。我能够在 terraform 中使用以下命令启用 winrm。 os_profile_windows_config { winrm { 协议 = "HTTP" }
      • @AlanGEORGE 正如我在回答中所说。您可以使用虚拟机扩展。看看example
      猜你喜欢
      • 1970-01-01
      • 2021-04-14
      • 1970-01-01
      • 2021-12-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-14
      相关资源
      最近更新 更多