Trying use provisioner "winrm"

I’m trying create a VM in Azure by terraform and I’d like to use the provisioner “remote-exec” using the “winrm” like connection, but I’m geting the following error:

Error: timeout - last error: unknown error Post "": dial tcp connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond```

My provisioner section is setup following:

provisioner "remote-exec" {
    connection {
      host        = azurerm_public_ip.publicip[count.index].ip_address
      type        = "winrm"
      user        = "${var.adm_user}"
      password    = "${var.adm_pass}"
      https       = "false"
      use_ntlm    = "false"
      port        = 5985

    inline = [
      "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Set- ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(''))"

Anybody can help me with this issue?