在 Azure 上使用 F#Using F# on Azure

F# 是一种出色的云编程语言,常用于编写 Web 应用程序、云服务、云托管微服务,也可用于可缩放数据处理。F# is a superb language for cloud programming and is frequently used to write web applications, cloud services, cloud-hosted microservices, and for scalable data processing.

在以下部分中,你将发现如何结合使用 F# 与一系列 Azure 服务的相关资源。In the following sections, you will find resources on how to use a range of Azure services with F#.

备注

如果某特定 Azure 服务不在此文档集中,请参阅适用于该服务的 Azure Functions 或 .NET 文档。If a particular Azure service isn't in this documentation set, please consult either the Azure Functions or .NET documentation for that service. 某些 Azure 服务独立于语言,不需要任何特定于语言的文档,未在此处列出。Some Azure services are language-independent and require no language-specific documentation and are not listed here.

使用 Azure 虚拟机和 F#Using Azure Virtual Machines with F#

Azure 支持各种不同的虚拟机 (VM) 配置,请参阅 Linux 和 Azure 虚拟机Azure supports a wide range of virtual machine (VM) configurations, see Linux and Azure Virtual Machines.

若要在虚拟机上安装 F# 用来执行、编译和/或编写脚本,请参阅在 Linux 上使用 F#在 Windows 上使用 F#To install F# on a virtual machine for execution, compilation and/or scripting see Using F# on Linux and Using F# on Windows.

使用 Azure Functions F#Using Azure Functions with F#

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. 函数连接到 Azure 存储和其他云托管资源中的事件。Your functions are connected to events in Azure storage and other cloud-hosted resources. 数据通过函数参数流入 F# 函数。Data flows into your F# functions via function arguments. 可以使用所选择的开发语言,信任 Azure 按需进行扩展。You can use your development language of choice, trusting Azure to scale as needed.

Azure Functions 支持 F# 作为第一类语言,它执行 F# 代码时高效、反应迅速且可缩放。Azure Functions support F# as a first-class language with efficient, reactive, scalable execution of F# code. 请参阅 Azure Functions F# 开发人员参考,了解如何将 F# 用于 Azure Functions 的相关参考文档。See the Azure Functions F# Developer Reference for reference documentation on how to use F# with Azure Functions.

结合使用 Azure Functions 和 F# 的其他资源:Other resources for using Azure Functions and F#:

使用 Azure 存储与 F#Using Azure Storage with F#

Azure 存储是一种基层存储服务,用于依赖于持久性、可用性和可缩放性来满足其客户需求的现代应用程序。Azure Storage is a base layer of storage services for modern applications that rely on durability, availability, and scalability to meet the needs of customers. F#程序可以直接与 Azure 存储服务,使用以下文章中所述的技术进行交互。F# programs can interact directly with Azure storage services, using the techniques described in the following articles.

Azure 存储还可以通过声明性配置(而非显式 API 调用)与 Azure Functions 结合使用。Azure Storage can also be used in conjunction with Azure Functions through declarative configuration rather than explicit API calls. 请参阅 Azure Functions triggers and bindings for Azure Storage(用于 Azure 存储的 Azure Functions 触发器和绑定),其中包括 F# 示例。See Azure Functions triggers and bindings for Azure Storage which includes F# examples.

使用 Azure 应用服务与 F#Using Azure App Service with F#

Azure 应用服务是一个用于构建功能强大的 Web 和移动应用的云平台,这些应用可连接到任何位置(云中或本地)的数据。Azure App Service is a cloud platform to build powerful web and mobile apps that connect to data anywhere, in the cloud or on-premises.

通过 Azure HDInsight 结合使用 Apache Spark 与 F#Using Apache Spark with F# with Azure HDInsight

Apache Spark for Azure HDInsight 是一个开放源代码处理框架,用于运行大型数据分析应用程序。Apache Spark for Azure HDInsight is an open source processing framework that runs large-scale data analytics applications. Azure 使 Apache Spark 的部署简单且经济实惠。Azure makes Apache Spark easy and cost effective to deploy. 通过 Mobius(适用于 Spark 的 .NET API)使用 F# 开发 Spark 应用程序。Develop your Spark application in F# using Mobius, a .NET API for Spark.

使用 Azure Cosmos DB 与 F#Using Azure Cosmos DB with F#

Azure Cosmos DB是高度可用的全球分布式应用的 NoSQL 服务。Azure Cosmos DB is a NoSQL service for highly available, globally distributed apps.

Azure Cosmos DB 可与F#通过两种方式:Azure Cosmos DB can be used with F# in two ways:

  1. 通过创建F#Azure Functions 响应或导致对 Azure Cosmos DB 集合的更改。Through the creation of F# Azure Functions which react to or cause changes to Azure Cosmos DB collections. 请参阅Azure Functions 的 Azure Cosmos DB 绑定,或See Azure Cosmos DB bindings for Azure Functions, or
  2. 通过使用用于 SQL API 的 Azure Cosmos DB.NET SDKBy using the Azure Cosmos DB .NET SDK for SQL API. 相关的示例采用 C# 编写。The related samples are in C#.

使用 Azure 事件中心与 F#Using Azure Event Hubs with F#

Azure 事件中心提供来自网站、应用和设备的云规模遥测引入。Azure Event Hubs provide cloud-scale telemetry ingestion from websites, apps, and devices.

可采用两种方式结合使用 Azure 事件中心与 F#:Azure Event Hubs can be used with F# in two ways:

  1. 通过创建由事件触发的 F# Azure Functions。Through the creation of F# Azure Functions which are triggered by events. 请参阅 Azure Function 事件中心触发器,或See Azure Function triggers for Event Hubs, or
  2. 通过使用适用于 Azure 的 .NET SDKBy using the .NET SDK for Azure. 请注意,这些示例使用的是 C#。Note these examples are in C#.

使用 Azure 通知中心与 F#Using Azure Notification Hubs with F#

Azure 通知中心是多平台扩展式推送基础结构,可使用它从任何后端(云中或本地)向任何移动平台发送移动推送通知。Azure Notification Hubs are multiplatform, scaled-out push infrastructure that enable you to send mobile push notifications from any backend (in the cloud or on-premises) to any mobile platform.

可采用两种方式结合使用 Azure 通知中心与 F#:Azure Notification Hubs can be used with F# in two ways:

  1. 通过创建向通知中心发送结果的 F# Azure Functions。Through the creation of F# Azure Functions which send results to a notification hub. 请参阅 Azure Functions 通知中心输出触发器,或See Azure Function output triggers for Notification Hubs, or
  2. 通过使用适用于 Azure 的 .NET SDKBy using the .NET SDK for Azure. 请注意,这些示例使用的是 C#。Note these examples are in C#.

通过 F 在 Azure 上实现 Webhook#Implementing WebHooks on Azure with F#

Webhook 是通过 Web 请求触发的回调。A Webhook is a callback triggered via a web request. Webhook 由 GitHub 等站点使用,用以向事件发送信号。Webhooks are used by sites such as GitHub to signal events.

Webhook 可采用 F# 实现,并通过 Azure Function in F# with a Webhook Binding(具有 Web 绑定的 F# Azure Function)在 Azure 上进行托管。Webhooks can be implemented in F# and hosted on Azure via an Azure Function in F# with a Webhook Binding.

使用 Webjob 与 F#Using Webjobs with F#

Webjob 是可采用以下三种方式在应用服务 Web 应用中运行的程序:按需、连续或按计划。Webjobs are programs you can run in your App Service web app in three ways: on demand, continuously, or on a schedule.

示例 F# WebjobExample F# Webjob

通过 F 在 Azure 上实现计时器#Implementing Timers on Azure with F#

计时器触发器基于计划调用一次或重复调用函数。Timer triggers call functions based on a schedule, one time or recurring.

计时器可采用 F# 实现,并通过 Azure Function in F# with a Timer Trigger(具有计时器触发器的 F# Azure Function)在 Azure 上进行托管。Timers can be implemented in F# and hosted on Azure via an Azure Function in F# with a Timer Trigger.

使用 F# 脚本部署和管理 Azure 资源Deploying and Managing Azure Resources with F# Scripts

可使用 Microsoft.Azure.Management 包和 API,以编程方式通过 F# 脚本部署和管理 Azure VM。Azure VMs may be programmatically deployed and managed from F# scripts by using the Microsoft.Azure.Management packages and APIs. 有关示例,请参阅 .NET 管理库入门使用 Azure 资源管理器For example, see Get Started with the Management Libraries for .NET and Using Azure Resource Manager.

同样,其他 Azure 资源也可用相同的组件通过 F# 脚本进行部署和管理。Likewise, other Azure resources may also be deployed and managed from F# scripts using the same components. 例如,创建存储帐户、 部署 Azure 云服务、 创建 Azure Cosmos DB 实例和管理 Azure 通知中心以编程方式从F#脚本。For example, you can create storage accounts, deploy Azure Cloud Services, create Azure Cosmos DB instances and manage Azure Notifcation Hubs programmatically from F# scripts.

通常,使用 F# 脚本来部署和管理资源并不必要。Using F# scripts to deploy and manage resources is not normally necessary. 例如,还可以直接从可参数化的 JSON 模板说明部署 Azure 资源。For example, Azure resources may also be deployed directly from JSON template descriptions, which can be parameterized. 请参阅 Azure 资源管理器模板,包括 Azure 快速入门模板等示例。See Azure Resource Manager Templates including examples such as the Azure Quickstart Templates.

其他资源Other resources