Azure Functions 简介An introduction to Azure Functions

Azure Functions 允许你运行小段代码(称为“函数”)且不需要担心应用程序基础结构。Azure Functions allows you to run small pieces of code (called "functions") without worrying about application infrastructure. 借助 Azure Functions,云基础结构可以提供应用程序保持规模化运行所需的所有最新状态的服务器。With Azure Functions, the cloud infrastructure provides all the up-to-date servers you need to keep your application running at scale.

函数由特定类型的事件“触发”。A function is "triggered" by a specific type of event. 支持的触发器包括对数据更改做出响应、对消息做出响应、按计划运行,或者生成 HTTP 请求的结果。Supported triggers include responding to changes in data, responding to messages, running on a schedule, or as the result of an HTTP request.

虽然你始终可以直接针对大量服务编写代码,但使用绑定可以简化与其他服务的集成。While you can always code directly against a myriad of services, integrating with other services is streamlined by using bindings. 使用绑定,你能够以声明方式访问各种 Azure 服务和第三方服务Bindings give you declarative access to a wide variety of Azure and third-party services.


Azure Functions 的一些主要功能包括:Some key features of Azure Functions include:

  • 无服务器应用程序:使用 Functions,可在 Azure 上开发无服务器应用程序。Serverless applications: Functions allow you to develop serverless applications on Azure.

  • 语言选择:使用所选的 C#、Java、JavaScript 和 PowerShell 编写函数。Choice of language: Write functions using your choice of C#, Java, JavaScript and PowerShell.

  • 按使用付费定价模型:仅为运行代码所用的时间付费。Pay-per-use pricing model: Pay only for the time spent running your code. 请参阅定价部分中的使用托管计划选项。See the Consumption hosting plan option in the pricing section.

  • 自带依赖项:Functions 支持 NuGet 和 NPM,允许你访问你喜欢的库。Bring your own dependencies: Functions supports NuGet and NPM, giving you access to your favorite libraries.

  • 集成的安全性:使用 OAuth 提供程序(如 Azure Active Directory 和 Microsoft 帐户)保护 HTTP 触发的函数。Integrated security: Protect HTTP-triggered functions with OAuth providers such as Azure Active Directory and Microsoft Account.

  • 简化的集成:轻松与 Azure 服务和软件即服务 (SaaS) 产品/服务进行集成。Simplified integration: Easily integrate with Azure services and software-as-a-service (SaaS) offerings.

  • 灵活开发:直接在门户中编写函数代码,或者通过 GitHubAzure DevOps Services 和其他受支持的开发工具设置持续集成和部署代码。Flexible development: Set up continuous integration and deploy your code through GitHub, Azure DevOps Services, and other supported development tools.

  • 有状态无服务器体系结构:使用 Durable Functions 协调无服务器应用程序。Stateful serverless architecture: Orchestrate serverless applications with Durable Functions.

  • 开放源代码:Functions 运行时是开源的,可在 GitHub 上找到Open-source: The Functions runtime is open-source and available on GitHub.

使用 Functions 可以做什么?What can I do with Functions?

Functions 是一个理想的解决方案,用于处理批量数据、集成系统、使用物联网 (IoT) 以及生成简单的 API 和微服务。Functions is a great solution for processing bulk data, integrating systems, working with the internet-of-things (IoT), and building simple APIs and micro-services.

有一系列模板可帮助你开始使用关键方案,包括:A series of templates is available to get you started with key scenarios including:

Functions 的费用是多少?How much does Functions cost?

Azure Functions 有三种定价计划。Azure Functions has three kinds of pricing plans. 请选择最适合自己的那种:Choose the one that best fits your needs:

  • 消耗计划:Azure 提供了所有必要的计算资源。Consumption plan: Azure provides all of the necessary computational resources. 你不必担心资源管理,只需为你的代码运行的时间付费。You don't have to worry about resource management, and only pay for the time that your code runs.

  • 应用服务计划:将函数像 Web 应用一样运行。App Service plan: Run your functions just like your web apps. 如果已对其他应用程序使用应用服务,可以按相同的计划运行你的函数,不用另外付费。If you use App Service for your other applications, your functions can run on the same plan at no additional cost.

有关托管计划的详细信息,请参阅 Azure Functions 托管计划比较For more information about hosting plans, see Azure Functions hosting plan comparison. 完整的定价详细信息可在 Functions 定价页中找到。Full pricing details are available on the Functions Pricing page.

后续步骤Next Steps