Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure VM自定义脚本扩展-随机失败_Azure_Powershell_Terraform_Iaas - Fatal编程技术网

Azure VM自定义脚本扩展-随机失败

Azure VM自定义脚本扩展-随机失败,azure,powershell,terraform,iaas,Azure,Powershell,Terraform,Iaas,我一直在使用Terraform对CustomScriptExtension进行故障排除 我使用它来部署和运行powershell脚本,该脚本在我部署的80%时间内都能正常工作。 我已经测试了48个虚拟机部署。 当它在VM2上失败时,例如下次我运行它时,它在VM2上成功 我正在使用Azure DevOps部署它 我的想法: resource "azurerm_virtual_machine_extension" "extension" { name = "Pro

我一直在使用Terraform对CustomScriptExtension进行故障排除 我使用它来部署和运行powershell脚本,该脚本在我部署的80%时间内都能正常工作。 我已经测试了48个虚拟机部署。 当它在VM2上失败时,例如下次我运行它时,它在VM2上成功

我正在使用Azure DevOps部署它

我的想法:

resource "azurerm_virtual_machine_extension" "extension" {
  name                 = "Proxy-Settings"
  location             = var.location
  resource_group_name  = var.resource_group_name
  virtual_machine_name = azurerm_virtual_machine.windows_vm.name
  publisher            = "Microsoft.Compute"
  type                 = "CustomScriptExtension"
  type_handler_version = "1.9"

  settings = <<SETTINGS
    {
        "fileUris": ["https://this_is_a_secret.blob.core.windows.net/scripts/autoProxyConfig.ps1"]
    }
    SETTINGS

  protected_settings = <<PROTECTED_SETTINGS
    {
      "commandToExecute"  : "powershell -ExecutionPolicy Unrestricted -File autoProxyConfig.ps1",
      "storageAccountName": "this_is_a_secret",
      "storageAccountKey" : "this_is_a_secret"
    }
    PROTECTED_SETTINGS
}
  • 在我看来,我们可以把地形从图片中去掉,因为问题似乎在Azure级别
以下是我的地形模块中的代码:

resource "azurerm_virtual_machine_extension" "extension" {
  name                 = "Proxy-Settings"
  location             = var.location
  resource_group_name  = var.resource_group_name
  virtual_machine_name = azurerm_virtual_machine.windows_vm.name
  publisher            = "Microsoft.Compute"
  type                 = "CustomScriptExtension"
  type_handler_version = "1.9"

  settings = <<SETTINGS
    {
        "fileUris": ["https://this_is_a_secret.blob.core.windows.net/scripts/autoProxyConfig.ps1"]
    }
    SETTINGS

  protected_settings = <<PROTECTED_SETTINGS
    {
      "commandToExecute"  : "powershell -ExecutionPolicy Unrestricted -File autoProxyConfig.ps1",
      "storageAccountName": "this_is_a_secret",
      "storageAccountKey" : "this_is_a_secret"
    }
    PROTECTED_SETTINGS
}

我知道您提到过PowerShell脚本不是问题,但是,您介意分享一下吗?
PowerShell脚本不是问题,因为它80%的时间都在工作
-lol。您得到的实际错误是什么(不是传播的错误)?你为什么不在没有terraform的情况下创建这个扩展来确认它不是terraform中无休止的bug之一?@4c74356b41我已经发布了PowerShell代码。删除了我关于PS不是问题的评论(lol)。我打字的时候还早。