【Azure Developer】Azure Automation 自動化賬號生成的時候怎麼生成連線 與證書 (Connection & Certificate)

路邊兩盞燈發表於2021-10-01

Azure Automation :The Azure Automation service provides a highly reliable and scalable workflow execution engine to automate frequently repeated management tasks. The processes are automated through runbooks, which are Windows PowerShell Workflows run in the Azure Automation execution engine. You can use this API to create, update, read, and delete automation resources, including runbooks and runbook jobs. In addition you can manage assets such as variables, schedules, Windows PowerShell modules, credentials, and certificates.

Azure 自動化服務提供了一個高度可靠和可擴充套件的工作流執行引擎,可以自動執行頻繁重複的管理任務。 這些流程通過 runbook 自動完成,這些 runbook 是在 Azure 自動化執行引擎中執行的 Windows PowerShell 工作流。 可以使用此 API 來建立、更新、讀取和刪除自動化資源,包括 runbook 和 runbook 作業。 此外,還可以管理諸如變數、時間表、Windows PowerShell 模組、憑據和證書等資產。

Source : https://docs.microsoft.com/en-us/rest/api/automation/

 

問題描述

自動化賬號( Automation Account )生成的時候怎麼生成連線( Connection )與證書( Certificate )?

 

問題回答

在中國區Azure中建立Connection時,需要修改為中國區的ARM Endpoint。比如Connection的Endpoint (終結點)應為:

https://management.chinacloudapi.cn
/subscriptions/<subscriptionid>
/resourceGroups/< resourceGroups >/providers/Microsoft.Automation
/automationAccounts/< automationAccounts name>
/connections/<connectionname>?api-version=2015-10-31

請求示例可參考:https://docs.microsoft.com/en-us/rest/api/automation/connection/create-or-update#create-or-update-connection

Sample Request

PUT https://management.chinacloudapi.cn/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts
/myAutomationAccount28/connections/mysConnection?api-version=2015-10-31

Request Body

{
  "name": "mysConnection",
  "properties": {
    "description": "my description goes here",
    "connectionType": {
      "name": "Azure"
    },
    "fieldDefinitionValues": {
      "AutomationCertificateName": "mysCertificateName",
      "SubscriptionID": "subid"
    }
  }
}

Sample Response

  • Status code:201

參考資料

Automation REST API Reference: https://docs.microsoft.com/en-us/rest/api/automation/

 

相關文章