簡體   English   中英

使用Terraform導入Azure Automation Runbook

[英]Import Azure Automation runbook using Terraform

誰能幫我一個問題:我想使用Terraform從Runbook畫廊中的Azure自動帳戶中導入一本Runbook。 在下面的示例中,我引用的是URI,但是我想從Runbook庫中導入:

  resource "azurerm_automation_runbook" "example" {
  name                = "Get-AzureVMTutorial"
  location            = "${azurerm_resource_group.example.location}"
  resource_group_name = "${azurerm_resource_group.example.name}"
  account_name        = "${azurerm_automation_account.example.name}"
  log_verbose         = "true"
  log_progress        = "true"
  description         = "This is an example runbook"
  runbook_type        = "PowerShellWorkflow"
  publish_content_link {
  uri = "${var.runbooklink}"
  }
  }`

在門戶中

自動化帳戶-> Runbook->瀏覽庫->選擇要導入的Runbook->查看源項目

在此處輸入圖片說明

復制網址

在此處輸入圖片說明

“查看源項目”將重定向到該特定Runbook的URI( gallery.technet.microsoft.com中的源代碼)

對於上面的圖像(例如,Azure Runbook的世界),它將URI重定向為我

https://gallery.technet.microsoft.com/scriptcenter/The-Hello-World-of-Windows-81b69574/file/111354/1/Write-HelloWorld.ps1

只需嘗試將其粘貼到您的代碼中( uri = "${var.runbooklink}"

resource "azurerm_automation_runbook" "demorunbook" {
  name                = "Write-HelloWorld"
  location            = "${azurerm_resource_group.development1.location}"
  resource_group_name = "${azurerm_resource_group.development1.name}"
  account_name        = "automationAccount1"
  log_verbose         = "true"
  log_progress        = "true"
  description         = "This is an example runbook"
  runbook_type        = "PowerShellWorkflow"
  publish_content_link {
  uri = "https://gallery.technet.microsoft.com/scriptcenter/The-Hello-World-of-Windows-81b69574/file/111354/1/Write-HelloWorld.ps1"
  }
  }

注意在源代碼中的Runbook的名稱應為您的Runbook的名稱

暫無
暫無

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

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