在 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# 以執行、編譯及/或處理指令碼,請參閱 Using F# on Linux (在 Linux 上使用 F#) 和 Using F# on Windows (在 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. 如需如何使用 F# 搭配 Azure Functions 的參考文件,請參閱 Azure Functions F# 開發人員參考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. 請參閱包含 F# 範例的 Azure 儲存體的 Azure Functions 觸發程序和繫結See Azure Functions triggers and bindings for Azure Storage which includes F# examples.

使用 Azure App Service 搭配 f ##Using Azure App Service with F#

Azure App Service 是一種雲端平台,用來建置功能強大的 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. 藉由使用Azure Cosmos DB.NET SDK for SQL APIBy 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. 透過使用 .NET SDK for AzureBy 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 Function 通知中樞的輸出觸發程序,或See Azure Function output triggers for Notification Hubs, or
  2. 透過使用 .NET SDK for AzureBy 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. GitHub 等網站會使用 Webhook 以訊號通知事件。Webhooks are used by sites such as GitHub to signal events.

您可以使用 F# 實作 Webhook,並透過含有 Webhook 繫結的 F# Azure Function 在 Azure 上裝載 Webhook。Webhooks can be implemented in F# and hosted on Azure via an Azure Function in F# with a Webhook Binding.

使用 Webjobs 搭配 f ##Using Webjobs with F#

Webjobs 是您可以使用下列三種方式在 App Service Web 應用程式中執行的程式:依需求、連續或根據排程。Webjobs are programs you can run in your App Service web app in three ways: on demand, continuously, or on a schedule.

Example F# Webjob (F# Webjob 範例)Example F# Webjob

使用 f # 在 Azure 上實作計時器#Implementing Timers on Azure with F#

計時器會根據排程,觸發一次或重複觸發呼叫函式。Timer triggers call functions based on a schedule, one time or recurring.

您可以使用 F# 實作計時器,並透過含有計時器觸發程序的 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

Azure VM 可能會使用 Microsoft.Azure.Management 套件和 API,透過 F# 指令碼以程式設計方式部署和管理。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. 例如,Azure 資源也可能會直接從 JSON 範本描述,可進行參數化部署。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