Build and deploy serverless applications with Azure Functions.
Azure Functions is a serverless compute service that lets you run code without provisioning or managing infrastructure. You pay only for the time your code runs and can scale automatically from seconds to minutes.
It's ideal for:
Azure Functions supports a variety of popular programming languages, including:
C#
Python
Java
JavaScript
TypeScript
PowerShell
Let's create a basic "Hello, World!" HTTP-triggered function.
func init MyFunctionProj --worker-runtime
<your-runtime>
with your preferred language runtime (e.g., dotnet
, python
, node
).
cd MyFunctionProj
func new --template "HTTP trigger" --name HttpExample
HttpExample/index.js
for Node.js, HttpExample.cs
for .NET).
Example (JavaScript):
module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
const name = (req.query.name || (req.body && req.body.name));
const responseMessage = name
? "Hello, " + name + ". This HTTP triggered function executed successfully!"
: "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.";
context.res = {
status: 200,
body: responseMessage
};
};
func start
http://localhost:7071/api/HttpExample
).
Once you've developed and tested your function locally, you can deploy it to Azure.
You can deploy using:
func azure functionapp publish <your-function-app-name>
Check out the official documentation for detailed deployment instructions.
Explore More Azure Functions DocsTip: Leverage Azure Functions bindings to easily connect to services like Azure Cosmos DB, Azure Storage, Service Bus, and more without writing complex integration code.