提供文件到Azurerm VM期间的连接超时 [英] Connection timeout during file provision to azurerm vm
问题描述
尝试将文件配置到Azure RM VM时,我收到以下超时消息.
I am getting below timeout message once trying to provision file to an azure RM VM .
未知错误发布 http://terraform.eastus.cloudapp.azure.com:3389/wsman:读取tcp 192.168.0.4:59745->52.224.162.240:3389:wsarecv:远程主机强行关闭了现有连接.
unknown error Post http://terraform.eastus.cloudapp.azure.com:3389/wsman: read tcp 192.168.0.4:59745->52.224.162.240:3389: wsarecv: An existing connection was forcibly closed by the remote host.
我正在尝试提供文件,并且VM已经在那里并且不需要创建它.我只需要使用以下配置将文本文件复制到现有VM.
I am trying file provision and the VM already there and no need to create it. I only need to copy a text file to an existing VM using below config.
provider "azurerm"
{
}
resource "null_resource" "test"
{
provisioner "file"
{
connection
{
type = "winrm"
user = ""
password = ""
host="terraform.eastus.cloudapp.azure.com"
port="3389"
timeout = "20m"
}
source = "D:\\jaish\\output.txt"
destination = "D:\\output.txt"
}
}
推荐答案
您可以在此
仅Winrm连接类型支持的其他参数:
Additional arguments only supported by the winrm connection type: https-设置为true以使用HTTPS而不是HTTP进行连接. https - Set to true to connect using HTTPS instead of HTTP. 现在,您使用的连接类型为 Now, you use connection type is 另一种解决方案,您可以使用 Azure自定义脚本为此.您可以创建脚本以从Azure存储帐户或github下载文件. Another solution, you could use Azure Custom Script to do this. You could create a script to download file from Azure Storage account or github. 使用terraform进行此操作,您可以检查 answer . Using terraform to do this, you could check this answer. 这篇关于提供文件到Azurerm VM期间的连接超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
winrm
,因此需要在VM的防火墙和Azure NSG上打开端口5986.您还需要创建一个自签名证书.您可以检查此winrm
, so you need open port 5986 on VM's firewall and Azure NSG. You also need create a self-signed certificate. You could check this blog to do this.