簡體   English   中英

Terraform 從 PSGallery 導入 runbook 到 Azure Automation Account

[英]Terraform import runbook to Azure Automation Account from PSGallery

我正在嘗試使用 Terraform 腳本從 PS Gallery 導入 runbook。 該腳本和 Azure API 均未拋出任何錯誤,並按預期創建了 Runbook。 問題是,runbook 的內容顯然是錯誤的。 我猜它是仍然壓縮的 nupkg 文件。

這是我正在使用的代碼:

resource "azurerm_automation_runbook" "imported_runbook" {
  name                    = var.import_runbook.name
  resource_group_name     = var.resource_group_name
  automation_account_name = var.automation_account_name
  location                = var.location
  log_verbose             = var.debug
  log_progress            = var.debug
  tags                    = var.tags
  runbook_type            = "PowerShell"

  publish_content_link {
    uri = var.import_runbook.uri
  }
}

這是 URL 我正在嘗試從以下位置獲取運行手冊:

https://www.powershellgallery.com/api/v2/package/Stop-SAPHANA/0.0.4

導入的內容只是大約 15 行的問號符號。

有沒有辦法只訪問原始 Powershell 代碼文件,只導入 Powershell 運行手冊而不是整個 package?

使用 Terraform 文檔中提供的示例進行嘗試效果很好。 這就是為什么我猜測問題可能來自導入 package 而不是原始代碼。

如果有幫助,請嘗試https://www.powershellgallery.com/packages/Stop-SAPHANA/0.0.4/Content/Stop-SAPHANA.ps1 如果沒有,那么您可能必須下載腳本,將其保存(使用 Save-Script cmdlet)在將其視為原始代碼的位置,然后使用它

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM