Share via


管理 Azure Logic Apps 整合帳戶中的成品中繼資料

適用於:Azure Logic Apps (使用量)

您可以在整合帳戶中定義成品的自訂中繼資料,並在執行階段期間取得該中繼資料以供邏輯應用程式工作流程使用。 例如,您可以提供成品的中繼資料,例如合作夥伴、合約、結構描述和對應。 所有這些成品類型都會將中繼資料儲存為索引鍵/值組。

本操作指南說明如何將中繼資料新增至整合帳戶成品。 然後,您就可以使用工作流程中的動作,擷取及使用中繼資料值。

必要條件

將中繼資料新增到成品

  1. Azure 入口網站,移至您的整合帳戶。

  2. 選取要新增中繼資料的成品,然後選取 [編輯]

    Screenshot of Azure portal, integration account, and 'Partners' page with 'TradingPartner1' and 'Edit' button selected.

  3. 在 [編輯] 窗格中,輸入該成品的中繼資料詳細資料,然後選取 [確定]。 下列螢幕擷取畫面顯示三對中繼資料索引鍵/值組:

    Screenshot of the 'Edit' pane for 'TradingPartner1'. Under 'Metadata', three key-value pairs are highlighted and 'OK' is selected.

  4. 若要在整合帳戶的 JavaScript 物件標記法 (JSON) 定義中檢視此中繼資料,請選取 [編輯為 JSON],這會開啟 JSON 編輯器。

    Screenshot of the JSON code that contains information about 'TradingPartner1'. In the 'metadata' object, three key-value pairs are highlighted.

取得成品中繼資料

  1. 在 Azure 入口網站中,開啟已連結到整合帳戶的邏輯應用程式資源。

  2. 在邏輯應用程式的導覽功能表上,選取 [邏輯應用程式設計工具]

  3. 在設計工具中,新增 [整合帳戶成品查閱] 動作以取得中繼資料。

    1. 在觸發程序或現有動作下,選取 [新增步驟]

    2. 在 [選擇作業] 搜尋方塊底下,選取 [內建]。 在搜尋方塊中,輸入整合帳戶

    3. 從動作清單中,選取名為 [整合帳戶成品查閱] 的動作。

    Screenshot of the designer for a Consumption logic app workflow with the 'Integration Account Artifact Lookup' action selected.

  4. 針對您想要尋找的成品提供下列資訊:

    屬性 必填 Description
    成品類型 Yes [結構描述]、[對應]、[合作夥伴]、[合約],或自訂類型 想要取得的成品類型
    成品名稱 Yes <artifact-name> 想要取得的成品名稱

    此範例會依照下列步驟,取得交易夥伴成品的中繼資料:

    1. [成品類型] 請選取 [合作夥伴]

    2. [成品名稱] 則在 [編輯] 方塊內按一下。 當動態內容清單出現時,從觸發程序中選取名稱輸出。

    Screenshot of the 'Integration Account Artifact Lookup' action with the 'Artifact Type' and 'Artifact Name' properties highlighted.

  5. 現在,新增您想要用來使用中繼資料的動作。 此範例會繼續執行內建的 HTTP 動作。

    Screenshot of the designer search box with 'http' entered, the 'Built-in' tab highlighted, and the HTTP action selected.

  6. 針對您希望 HTTP 動作使用的成品中繼資料,提供下列資訊。

    例如,假設您想要取得之前新增的 routingUrl 中繼資料。 以下是您可以指定的屬性值:

    屬性 必填 Description 範例值
    方法 Yes <operation-to-run> 要在成品上執行的 HTTP 作業。 在此 HTTP 動作使用 GET 方法。
    URI Yes <metadata-location> 您想要傳送傳出要求的端點。 請遵循下列步驟,參考所擷取成品的 routingUrl 中繼資料值:

    1.在 [URI] 方塊內按一下。

    2.在動態內容清單開啟時,選取 [運算式]

    3.在運算式編輯器中,輸入類似以下範例的運算式:

    outputs('Integration_Account_Artifact_Lookup')['properties']['metadata']['routingUrl']

    4.完成後,選取 [確定]
    標題 No <header-values> 來自想要傳遞到 HTTP 動作之觸發程序的任何標頭輸出。 若要傳入觸發程序標頭的 Content-Type 值,請遵循下列步驟以取得標頭下的第一個資料列:

    1.在第一個資料行中,輸入 Content-Type 作為標頭名稱。

    2.在第二個資料行中,使用運算式編輯器輸入下列運算式作為標頭值:

    triggeroutputs()['headers']['Content-Type']

    若要傳入觸發程序標頭的 Host 值,請遵循下列步驟以取得標頭下的第二個資料列:

    1.在第一個資料行中,輸入 Host 作為標頭名稱。

    2.在第二個資料行中,使用運算式編輯器輸入下列運算式作為標頭值:

    triggeroutputs()['headers']['Host']
    本文 No <body-content> 您想要透過 HTTP 動作的 body 屬性傳遞的任何其他內容。 將成品的 properties 值傳遞至 HTTP 動作:

    1.在 [本文] 方塊內按一下,開啟動態內容清單。 如未出現屬性,請選取 [查看更多]

    2.從動態內容清單中,在 [整合帳戶成品查閱] 底下,選取 [屬性]

    以下螢幕擷取畫面顯示範例值:

    Screenshot of the designer with an HTTP action. Some property values are highlighted. The dynamic content list is open with 'Properties' highlighted.

  7. 若要檢查您為 HTTP 動作提供的資訊,您可檢視工作流程的 JSON 定義。 在設計工具的工具列上,選取 [程式碼檢視]

    出現的工作流程 JSON 定義,如以下範例所示:

    Screenshot of the HTTP action's JSON definition with the 'body', 'headers', 'method', and 'URI' properties highlighted.

  8. 在程式碼檢視工具列上,選取 [設計工具]

    您在設計工具中輸入的任何運算式現在都會顯示為已解決。

    Screenshot of the designer with the 'URI', 'Headers', and 'Body' expressions now resolved.

下一步