gpt4 book ai didi

azure - WinRM 与远程执行连接超时 - Azure Terraform

转载 作者:行者123 更新时间:2023-12-03 05:20:29 25 4
gpt4 key购买 nike

connection {
type = "winrm"
user = "testadmin"
password = "Password1234!"
host = azurerm_public_ip.example.ip_address

}配置者“远程执行”{

 script = "C:\\Proj\\Fali\\vm\\DC.ps1" 
}

我已经打开了所有端口

direction                  = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"

运行 PS 脚本期间连接超时,提到的是代码片段

最佳答案

解决上述问题的解决方法之一;

您可以通过配置文件名并为其提供超时值,在 example.tf 文件中使用以下格式。

connection {
host = azurerm_public_ip.win_pubip.fqdn
type = "winrm"
port = 5985
https = false
timeout = "2m"
user = var.username
password = var.password
}

provisioner "file" {
source = "files/yourfile.ps1"
destination = "c:/terraform/yourfile.ps1"
}

provisioner "remote-exec" {
inline = [
"PowerShell.exe -ExecutionPolicy Bypass c:\\terraform\\yourfile.ps1",
]

有关如何配置和执行配置脚本的完整信息,请参阅此

GitHub Sample code

有关更多信息,请参阅以下链接:-

关于azure - WinRM 与远程执行连接超时 - Azure Terraform,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72709419/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com