在 Azure 中選擇正確的整合和自動化服務Choose the right integration and automation services in Azure

本文會比較下列 Microsoft 雲端服務:This article compares the following Microsoft cloud services:

所有這些服務都可以解決整合問題,以及自動化商業流程。All of these services can solve integration problems and automate business processes. 它們全都可以定義輸入、動作、條件和輸出。They can all define input, actions, conditions, and output. 您可以在排程或觸發程序上執行上述各項服務。You can run each of them on a schedule or trigger. 各服務都有獨特的優點,本文將說明這些差異。Each service has unique advantages, and this article explains the differences.

如果您要了解 Azure Functions 和其他 Azure 計算選項之間較常見的比較,請參閱選擇 Azure 計算服務的準則選擇適用於微服務的 Azure 計算選項If you're looking for a more general comparison between Azure Functions and other Azure compute options, see Criteria for choosing an Azure compute service and Choosing an Azure compute option for microservices.

比較 Microsoft Power Automate 和 Azure Logic AppsCompare Microsoft Power Automate and Azure Logic Apps

Power Automate 和 Logic Apps 都是可建立工作流程的「設計工具優先」 整合服務。Power Automate and Logic Apps are both designer-first integration services that can create workflows. 這兩個服務皆可與各種 SaaS 和企業應用程式整合。Both services integrate with various SaaS and enterprise applications.

Power Automate 是以 Logic Apps 為基礎所建置。Power Automate is built on top of Logic Apps. 它們共用相同的工作流程設計工具和相同的連接器They share the same workflow designer and the same connectors.

Power Automate 可讓任何辦公室工作人員有能力執行簡單的整合 (例如,SharePoint 文件庫中的核准程序),而不必透過開發人員或 IT。Power Automate empowers any office worker to perform simple integrations (for example, an approval process on a SharePoint Document Library) without going through developers or IT. Logic Apps 也可以實現需要企業級 Azure DevOps 和安全性做法的進階整合 (例如 B2B 處理程序)。Logic Apps can also enable advanced integrations (for example, B2B processes) where enterprise-level Azure DevOps and security practices are required. 一般來說,商務工作流程會隨著時間而趨於複雜。It's typical for a business workflow to grow in complexity over time. 因此,一開始您可以先從流程著手,然後再視需要將它轉換為邏輯應用程式。Accordingly, you can start with a flow at first, and then convert it to a logic app as needed.

下表可協助您判斷最適合特定整合的是 Power Automate 還是 Logic Apps:The following table helps you determine whether Power Automate or Logic Apps is best for a particular integration:

Power AutomatePower Automate Logic AppsLogic Apps
使用者Users 辦公室員工、商務使用者、SharePoint 系統管理員Office workers, business users, SharePoint administrators 專業的整合人員和開發人員,IT 專業人員Pro integrators and developers, IT pros
案例Scenarios 自助服務Self-service 進階整合Advanced integrations
設計工具Design tool 瀏覽器內及行動裝置應用程式,僅限 UIIn-browser and mobile app, UI only 有瀏覽器內和 Visual Studio程式碼檢視可用In-browser and Visual Studio, Code view available
應用程式生命週期管理 (ALM)Application lifecycle management (ALM) 在非生產環境中設計及測試,在就緒時升級到生產環境Design and test in non-production environments, promote to production when ready Azure DevOps:在 Azure Resource Manager 中的原始檔控制、測試支援、自動化及管理性Azure DevOps: source control, testing, support, automation, and manageability in Azure Resource Manager
管理員體驗Admin experience 管理 Power Automate 環境和資料外洩防護 (DLP) 原則,追蹤授權:管理中心Manage Power Automate environments and data loss prevention (DLP) policies, track licensing: Admin center 管理資源群組、連線、存取管理和記錄:Azure 入口網站Manage resource groups, connections, access management, and logging: Azure portal
安全性Security Office 365 安全性與相容性稽核記錄、DLP、敏感性資料靜止時加密Office 365 Security and Compliance audit logs, DLP, encryption at rest for sensitive data Azure 的安全性保證︰Azure 安全性Azure 資訊安全中心稽核記錄Security assurance of Azure: Azure security, Azure Security Center, audit logs

比較 Azure Functions 和 Azure Logic AppsCompare Azure Functions and Azure Logic Apps

Functions 和 Logic Apps 都是可啟用無伺服器工作負載的 Azure 服務。Functions and Logic Apps are Azure services that enable serverless workloads. Azure Functions 是無伺服器計算服務,而 Azure Logic Apps 可提供無伺服器工作流程。Azure Functions is a serverless compute service, whereas Azure Logic Apps provides serverless workflows. 兩者皆可建立複雜的「協調流程」 。Both can create complex orchestrations. 協調流程是函式或步驟的集合,在 Logic Apps 中稱為「動作」 ,您可執行其來完成複雜工作。An orchestration is a collection of functions or steps, called actions in Logic Apps, that are executed to accomplish a complex task. 例如處理命令批次,您可以平行執行許多函式執行個體、等待執行個體完成,然後執行函式來計算彙總結果。For example, to process a batch of orders, you might execute many instances of a function in parallel, wait for all instances to finish, and then execute a function that computes a result on the aggregate.

對於 Azure Functions,您可以透過撰寫程式碼和使用 Durable Functions 擴充功能來開發協調流程。For Azure Functions, you develop orchestrations by writing code and using the Durable Functions extension. 對於 Logic apps,您可以使用 GUI 或編輯組態檔來建立協調流程。For Logic Apps, you create orchestrations by using a GUI or editing configuration files.

您可以在建置協調流程時混合搭配服務,從邏輯應用程式呼叫函式和從函式呼叫邏輯應用程式。You can mix and match services when you build an orchestration, calling functions from logic apps and calling logic apps from functions. 選擇如何建置每個協調流程,取決於服務的功能或您的個人喜好。Choose how to build each orchestration based on the services' capabilities or your personal preference. 下表列出其間的一些主要差異:The following table lists some of the key differences between these:

長期函式Durable Functions Logic AppsLogic Apps
開發Development Code First (命令式)Code-first (imperative) Designer First (宣告式)Designer-first (declarative)
連線能力Connectivity 約有十幾個內建繫結類型、撰寫自訂繫結的程式碼About a dozen built-in binding types, write code for custom bindings 連接器的大型集合適用於 B2B 的企業整合套件案例建置自訂連接器Large collection of connectors, Enterprise Integration Pack for B2B scenarios, build custom connectors
動作Actions 每個活動都是 Azure 函式;撰寫活動函式的程式碼Each activity is an Azure function; write code for activity functions 現成動作的大型集合Large collection of ready-made actions
監視Monitoring Azure Application InsightsAzure Application Insights Azure 入口網站Azure 監視器記錄Azure portal, Azure Monitor logs
管理Management REST APIVisual StudioREST API, Visual Studio Azure 入口網站REST APIPowerShellVisual StudioAzure portal, REST API, PowerShell, Visual Studio
執行內容Execution context 可以在本機或雲端中執行Can run locally or in the cloud 只可在雲端中執行Runs only in the cloud

比較 Functions 和 WebjobCompare Functions and WebJobs

如同 Azure Functions,搭配 WebJobs SDK 的 Azure App Service WebJobs 是針對開發人員所設計的 Code First 整合服務。Like Azure Functions, Azure App Service WebJobs with the WebJobs SDK is a code-first integration service that is designed for developers. 兩者皆以 Azure App Service 為基礎,並支援原始檔控制整合驗證使用 Application Insights 整合進行監視等功能。Both are built on Azure App Service and support features such as source control integration, authentication, and monitoring with Application Insights integration.

WebJob 和 WebJob SDKWebJobs and the WebJobs SDK

您可以使用 App Service 的 WebJobs 功能在 App Service Web 應用程式的環境中執行指令碼或程式碼。You can use the WebJobs feature of App Service to run a script or code in the context of an App Service web app. WebJobs SDK 是為 WebJobs 設計的架構,可簡化您在回應 Azure 服務中的事件時所撰寫的程式碼。The WebJobs SDK is a framework designed for WebJobs that simplifies the code you write to respond to events in Azure services. 例如,您可藉由建立縮圖影像來回應 Azure 儲存體中的映像 Blob 建立。For example, you might respond to the creation of an image blob in Azure Storage by creating a thumbnail image. WebJobs SDK 以 .NET 主控台應用程式的形式執行,您可以將其部署至 WebJob。The WebJobs SDK runs as a .NET console application, which you can deploy to a WebJob.

搭配使用 WebJobs 和 WebJobs SDK 的效果最好,但您也可以在沒有 WebJobs SDK 情況下使用 WebJobs,反之亦然。WebJobs and the WebJobs SDK work best together, but you can use WebJobs without the WebJobs SDK and vice versa. WebJob 可執行 App Service 沙箱中執行的任何程式或指令碼。A WebJob can run any program or script that runs in the App Service sandbox. WebJobs SDK 主控台應用程式可以在任何可執行主控台應用程式的地方執行,例如內部部署伺服器。A WebJobs SDK console application can run anywhere console applications run, such as on-premises servers.

比較表Comparison table

Azure Functions 是以 WebJobs SDK 為基礎,因此其共用許多相同的事件觸發程序及與其他 Azure 服務的連線。Azure Functions is built on the WebJobs SDK, so it shares many of the same event triggers and connections to other Azure services. 以下是在 Azure Functions 和搭配 WebJobs SDK 的 WebJobs 之間做選擇時的一些考量因素:Here are some factors to consider when you're choosing between Azure Functions and WebJobs with the WebJobs SDK:

函式Functions 搭配 WebJobs SDK 的 WebJobsWebJobs with WebJobs SDK
無伺服器應用程式模型自動調整Serverless app model with automatic scaling
在瀏覽器中開發與測試Develop and test in browser
按使用次數付費的定價方式Pay-per-use pricing
與 Logic Apps 整合Integration with Logic Apps
觸發程序事件Trigger events 計時器Timer
Azure 儲存體佇列和 BlobAzure Storage queues and blobs
Azure 服務匯流排佇列和主題Azure Service Bus queues and topics
Azure Cosmos DBAzure Cosmos DB
Azure 事件中樞Azure Event Hubs
HTTP/WebHook (GitHub、Slack)HTTP/WebHook (GitHub, Slack)
事件格線Azure Event Grid
Azure 儲存體佇列和 BlobAzure Storage queues and blobs
Azure 服務匯流排佇列和主題Azure Service Bus queues and topics
Azure Cosmos DBAzure Cosmos DB
Azure 事件中樞Azure Event Hubs
檔案系統File system
支援的語言Supported languages C#C#
套件管理員Package managers NPM 和 NuGetNPM and NuGet NuGet2NuGet2

1 WebJobs (沒有 WebJobs SDK) 支援 C#、Java、JavaScript、Bash、.cmd、.bat、PowerShell、PHP、TypeScript、Python 等其他項目。1 WebJobs (without the WebJobs SDK) supports C#, Java, JavaScript, Bash, .cmd, .bat, PowerShell, PHP, TypeScript, Python, and more. 這並非完整清單。This is not a comprehensive list. WebJob 可執行 App Service 沙箱中執行的任何程式或指令碼。A WebJob can run any program or script that can run in the App Service sandbox.

2 WebJobs (沒有 WebJobs SDK) 支援 NPM 和 NuGet。2 WebJobs (without the WebJobs SDK) supports NPM and NuGet.


Azure Functions 能提供比 Azure App Service WebJobs 還高的生產力。Azure Functions offers more developer productivity than Azure App Service WebJobs does. 其也可提供更多的程式設計語言、開發環境、Azure 服務整合和定價選項。It also offers more options for programming languages, development environments, Azure service integration, and pricing. 大部分的情況下,這是最佳選擇。For most scenarios, it's the best choice.

但在以下兩個案例中,WebJobs 可能是最好的選擇:Here are two scenarios for which WebJobs may be the best choice:

  • 您需要更充分地掌控接聽事件的程式碼 (JobHost 物件)。You need more control over the code that listens for events, the JobHost object. Functions 提供有限的方式來自訂 host.json 檔案中的 JobHost 行為。Functions offers a limited number of ways to customize JobHost behavior in the host.json file. 有時候,您需要執行的一些作業,無法由 JSON 檔案中的字串來指定。Sometimes you need to do things that can't be specified by a string in a JSON file. 例如,只有 WebJobs SDK 可讓您為 Azure 儲存體設定自訂的重試原則。For example, only the WebJobs SDK lets you configure a custom retry policy for Azure Storage.
  • 您有要為其執行程式碼片段的 App Service 應用程式,而且想要在相同的 Azure DevOps 環境中一起管理。You have an App Service app for which you want to run code snippets, and you want to manage them together in the same Azure DevOps environment.

針對其他需執行程式碼片段來整合 Azure 或第三方服務的情況,請選擇 Azure Functions,而不是搭配 WebJobs SDK 的 WebJobs。For other scenarios where you want to run code snippets for integrating Azure or third-party services, choose Azure Functions over WebJobs with the WebJobs SDK.

Power Automate、Logic Apps、Functions 和 WebJobs 一起Power Automate, Logic Apps, Functions, and WebJobs together

您不必只選擇其中一項服務。You don't have to choose just one of these services. 這些服務可彼此整合,如同與外部服務搭配使用時一樣。They integrate with each other as well as they do with external services.

流程可呼叫邏輯應用程式。A flow can call a logic app. 邏輯應用程式可呼叫函式,而函式可呼叫邏輯應用程式。A logic app can call a function, and a function can call a logic app. 如需範例,可參閱建立與 Azure Logic Apps 整合的函式See, for example, Create a function that integrates with Azure Logic Apps.

Power Automate、Logic Apps 和 Functions 之間的整合會隨時間持續改進。The integration between Power Automate, Logic Apps, and Functions continues to improve over time. 您可以在某項服務中建置某物並用於其他服務。You can build something in one service and use it in the other services.

您可以使用下列連結取得有關整合服務的詳細資訊︰You can get more information on integration services by using the following links:

後續步驟Next steps

開始建立您的第一個資料流程、邏輯應用程式或函式應用程式。Get started by creating your first flow, logic app, or function app. 選取下列任何連結︰Select any of the following links: