設定使用生命週期工作流程的邏輯應用程式
您必須先相容,才能使用現有的 Azure 邏輯應用程式搭配生命週期工作流程的自定義工作延伸功能。 本參考指南提供必須採取的步驟清單,讓 Azure 邏輯應用程式相容。 如需透過生命週期工作流程入口網站建立新相容邏輯應用程式的指南,請參閱 根據自定義工作延伸模塊觸發 Logic Apps。
決定自定義工作延伸模組的令牌安全性類型
設定 Azure 邏輯應用程式自定義延伸模組以搭配生命週期工作流程使用之前,您必須先瞭解其擁有的令牌安全性類型。 這兩種令牌安全性類型可以是:
- 一般
- 擁有證明(POP)
若要判斷自定義工作延伸模組的安全性令牌類型,請檢查 [自定義擴充功能 ] 頁面:
注意
新的自定義工作延伸模組只會有擁有權證明(POP) 令牌安全性類型。 只有在包含擁有權證明令牌安全性類型之前建立的工作延伸模組才會有一種「一般」類型。
設定現有的Logic Apps 以使用 LCW
讓 Azure 邏輯應用程式與自訂工作延伸模組相容,需要下列步驟:
- 設定邏輯應用程式觸發程式
- 設定回呼動作 (僅適用於回呼案例。
- 啟用系統指派的受控識別(一律需要一般安全性令牌類型延伸模組。這也是使用自定義工作延伸模組的回呼案例預設值。如需此案例和其他自定義工作延伸模組部署案例的詳細資訊,請參閱: 自定義工作延伸模組部署案例。
- 設定 AuthZ 原則
若要設定,請遵循下列步驟:
開啟您想要搭配生命週期工作流程使用的 Azure 邏輯應用程式。 Logic Apps 可能會以簡介畫面迎接您,您可以在右上角關閉 X。
在畫面左側,選取 [ 邏輯應用程式程序代碼檢視]。
在編輯器中貼上下列程式代碼:
{ "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "actions": { "HTTP": { "inputs": { "authentication": { "audience": "https://graph.microsoft.com", "type": "ManagedServiceIdentity" }, "body": { "data": { "operationStatus": "Completed" }, "source": "sample", "type": "lifecycleEvent" }, "method": "POST", "uri": "https://graph.microsoft.com/beta@{triggerBody()?['data']?['callbackUriPath']}" }, "runAfter": {}, "type": "Http" } }, "contentVersion": "1.0.0.0", "outputs": {}, "parameters": {}, "triggers": { "manual": { "inputs": { "schema": { "properties": { "data": { "properties": { "callbackUriPath": { "description": "CallbackUriPath used for Resume Action", "title": "Data.CallbackUriPath", "type": "string" }, "subject": { "properties": { "displayName": { "description": "DisplayName of the Subject", "title": "Subject.DisplayName", "type": "string" }, "email": { "description": "Email of the Subject", "title": "Subject.Email", "type": "string" }, "id": { "description": "Id of the Subject", "title": "Subject.Id", "type": "string" }, "manager": { "properties": { "displayName": { "description": "DisplayName parameter for Manager", "title": "Manager.DisplayName", "type": "string" }, "email": { "description": "Mail parameter for Manager", "title": "Manager.Mail", "type": "string" }, "id": { "description": "Id parameter for Manager", "title": "Manager.Id", "type": "string" } }, "type": "object" }, "userPrincipalName": { "description": "UserPrincipalName of the Subject", "title": "Subject.UserPrincipalName", "type": "string" } }, "type": "object" }, "task": { "properties": { "displayName": { "description": "DisplayName for Task Object", "title": "Task.DisplayName", "type": "string" }, "id": { "description": "Id for Task Object", "title": "Task.Id", "type": "string" } }, "type": "object" }, "taskProcessingResult": { "properties": { "createdDateTime": { "description": "CreatedDateTime for TaskProcessingResult Object", "title": "TaskProcessingResult.CreatedDateTime", "type": "string" }, "id": { "description": "Id for TaskProcessingResult Object", "title": "TaskProcessingResult.Id", "type": "string" } }, "type": "object" }, "workflow": { "properties": { "displayName": { "description": "DisplayName for Workflow Object", "title": "Workflow.DisplayName", "type": "string" }, "id": { "description": "Id for Workflow Object", "title": "Workflow.Id", "type": "string" }, "workflowVersion": { "description": "WorkflowVersion for Workflow Object", "title": "Workflow.WorkflowVersion", "type": "integer" } }, "type": "object" } }, "type": "object" }, "source": { "description": "Context in which an event happened", "title": "Request.Source", "type": "string" }, "type": { "description": "Value describing the type of event related to the originating occurrence.", "title": "Request.Type", "type": "string" } }, "type": "object" } }, "kind": "Http", "type": "Request" } } }, "parameters": {} }
選取 [儲存]。
切換至邏輯應用程式設計工具,並檢查已設定的觸發程式和回呼動作。 若要建置您的自定義商業規則,請在觸發程式和回呼動作之間新增其他動作。 如果您只對 fire-and-forget 案例感興趣,您可以移除回呼動作。
在畫面左側,選取 [ 身分識別]。
在系統指派的索引標籤下,啟用狀態以 Microsoft Entra ID 進行註冊。
選取 [儲存]。
使用 POP 安全性令牌類型設定自定義工作延伸模組的授權原則
如果安全性令牌類型是 自定義工作延伸模組的擁有權證明(POP), 您可以遵循下列步驟來設定授權原則:
移至您建立的邏輯應用程式,然後選取 [ 授權]。
根據下表建立授權原則:
原則名稱:
POP-Policy
原則類型:
AADPOP
索賠 值 Issuer https://sts.windows.net/(Tenant 識別碼)/ appid 00001111-aaaa-2222-bbbb-3333cccc4444 m POST u management.azure.com p /subscriptions/(subscriptionId)/resourceGroups/(resourceGroupName)/providers/Microsoft.Logic/workflows/(LogicApp name) 儲存授權原則。
警告
請注意詳細數據,因為次要差異可能會導致稍後發生問題。
- 針對
Issuer
,請確定您在租使用者標識碼之後包含斜線 - 針對
appid
,請確定自定義宣告位於appid
所有小寫中。 值appid
代表生命週期工作流程,且一律相同。
使用一般安全性令牌類型設定自定義工作延伸模組的授權原則
如果自定義工作延伸模組的安全性令牌類型為 [一般 ],您可以遵循下列步驟來設定授權原則:
針對 Logic Apps 授權原則,我們需要受控識別 應用程式識別碼。 由於 Microsoft Entra 系統管理中心只會顯示物件識別碼,因此我們需要查閱應用程式識別碼。 您可以在 Microsoft Entra 系統管理中心的 [企業應用程式] 底下,依物件標識碼搜尋受控識別,以尋找所需的應用程式識別碼。
返回您所建立的邏輯應用程式,然後選取 [ 授權]。
根據下列數據表建立兩個授權原則:
原則名稱:
AzureADLifecycleWorkflowsAuthPolicy
原則類型:
AAD
索賠 值 Issuer https://sts.windows.net/(Tenant 識別碼)/ 對象 Logic Apps 受控識別的應用程式識別碼 appid 00001111-aaaa-2222-bbbb-3333cccc4444 原則名稱:
AzureADLifecycleWorkflowsAuthPolicyV2App
原則類型:
AAD
索賠 值 Issuer https://login.microsoftonline.com/(Tenant ID)/v2.0 對象 Logic Apps 受控識別的應用程式識別碼 azp ce79fdc4-cd1d-4ea5-8139-e74d7dbe0bb7 儲存授權原則。
警告
請注意詳細數據,因為次要差異可能會導致稍後發生問題。
- 針對
Issuer
,請確定您在租使用者標識碼之後包含斜線。 - 針對物件,請確定您使用的是應用程式識別碼,而不是受控識別的物件標識碼。
- 針對
appid
,請確定自定義宣告位於appid
所有小寫中。 值appid
代表生命週期工作流程,且一律相同。
搭配生命週期工作流程使用邏輯應用程式
既然邏輯應用程式已設定為與生命週期工作流程搭配使用,您可以透過UI或API建立自定義工作延伸模組,並在生命週期工作流程中使用。
下一步
意見反映
https://aka.ms/ContentUserFeedback。
即將推出:我們會在 2024 年淘汰 GitHub 問題,並以全新的意見反應系統取代並作為內容意見反應的渠道。 如需更多資訊,請參閱:提交及檢視以下的意見反映: