Azure Functions 簡介An introduction to Azure Functions

10/03/2017

參與者

本文內容

Azure Functions 是可在雲端輕鬆執行程式碼片段或「函數」的解決方案。Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud.您可以只撰寫處理手邊問題所需的程式碼，而不需擔心要執行它的整個應用程式或基礎結構。You can write just the code you need for the problem at hand, without worrying about a whole application or the infrastructure to run it.Functions 可讓開發更有生產力，而且您可以使用您選擇的開發語言，例如 C#、F#、Node.js、Java 或 PHP。Functions can make development even more productive, and you can use your development language of choice, such as C#, F#, Node.js, Java, or PHP.只需對您的程式碼執行的時間付費，並信任 Azure 視需要調整。Pay only for the time your code runs and trust Azure to scale as needed.Azure Functions 可讓您在 Microsoft Azure 上開發 無伺服器應用程式。Azure Functions lets you develop serverless applications on Microsoft Azure.

我可以用 Functions 來做什麼？What can I do with Functions?

Functions 是處理資料、整合系統、使用物聯網 (IoT)，以及建置簡單 API 和微服務的絕佳解決方案。Functions is a great solution for processing data, integrating systems, working with the internet-of-things (IoT), and building simple APIs and microservices.考慮將 Functions 用於如下的工作：映像或訂單處理、檔案維護，或者您要排程執行的任何工作。Consider Functions for tasks like image or order processing, file maintenance, or for any tasks that you want to run on a schedule.

Functions 提供範本，可讓您開始使用重要的案例，包括下列案例︰Functions provides templates to get you started with key scenarios, including the following:

ServiceBusTopicTrigger - 將程式碼連接至其他 Azure 服務或內部部署服務，方法是訂閱主題。ServiceBusTopicTrigger - Connect your code to other Azure services or on-premises services by subscribing to topics.如需詳細資訊，請參閱服務匯流排繫結。For more information, see Service Bus bindings.

Azure Functions 支援「觸發」，這是開始執行您的程式碼的方式，以及「繫結」，這是針對輸入和輸出資料簡化編碼的方式。Azure Functions supports triggers, which are ways to start execution of your code, and bindings, which are ways to simplify coding for input and output data.如需 Azure Functions 提供的觸發和繫結的詳細說明，請參閱 Azure Functions 觸發和繫結開發人員參考。For a detailed description of the triggers and bindings that Azure Functions provides, see Azure Functions triggers and bindings developer reference.

整合Integrations

Azure Functions 可以與各種 Azure 和協力廠商服務整合。Azure Functions integrates with various Azure and 3rd-party services.這些服務可以觸發您的函式並開始執行，或做為您程式碼的輸入和輸出。These services can trigger your function and start execution, or they can serve as input and output for your code.Azure Functions 支援下列服務整合：The following service integrations are supported by Azure Functions:

Azure Cosmos DBAzure Cosmos DB

Azure 事件中心Azure Event Hubs

Azure Event GridAzure Event Grid

Azure Mobile Apps (資料表)Azure Mobile Apps (tables)

Azure 通知中心Azure Notification Hubs

Azure 服務匯流排 (佇列和主題)Azure Service Bus (queues and topics)

Azure 儲存體 (Blob、佇列和資料表)Azure Storage (blob, queues, and tables)

GitHub (webhook)GitHub (webhooks)

內部部署 (使用服務匯流排)On-premises (using Service Bus)

Twilio (SMS 訊息)Twilio (SMS messages)

Functions 的計費方式How much does Functions cost?

Azure Functions 有兩種定價方案。Azure Functions has two kinds of pricing plans.請選擇最符合您需求的方案：Choose the one that best fits your needs:

使用情況方案：當您的函式執行時，Azure 會提供所有必要的運算資源。Consumption plan - When your function runs, Azure provides all of the necessary computational resources.您不必擔心資源管理，您只需為您的程式碼執行時間支付費用。You don't have to worry about resource management, and you only pay for the time that your code runs.

App Service 方案 - 可讓您如同 Web、行動及 API 應用程式一樣執行函數。App Service plan - Run your functions just like your web, mobile, and API apps.當您已準備對其他應用程式使用 App Service 時，您可以在相同方案上執行您的函數，不會產生額外的費用。When you are already using App Service for your other applications, you can run your functions on the same plan at no additional cost.

如何調整 Azure 函式How to scale Azure Functions討論 Azure Functions 可用的服務方案，包括使用情況主控方案，以及如何選擇正確的方案。Discusses service plans available with Azure Functions, including the Consumption hosting plan, and how to choose the right plan.