Getting started with Azure Functions with C#
Posted: (EET/GMT+2)
If you haven't tried Azure Functions yet, they're an easy way to run small pieces of C# code in the cloud without spinning up a full web app or VM. You just write a function, publish it, and Azure runs it on demand.
Start locally by installing the tools:
npm install -g azure-functions-core-tools
Then create a new function app and a C# function:
func init MyFunctionApp --worker-runtime dotnet cd MyFunctionApp func new --name HelloHttp --template "HTTP trigger"
This creates a ready-to-run project. You can start it locally:
func start
Now open your browser to http://localhost:7071/api/HelloHttp?name=World. You'll see your first Azure Function in action.
When you're ready to deploy, log in and publish:
az login func azure functionapp publish MyFunctionApp
That's all you need: a few lines of C#, a trigger, and no infrastructure to manage. You can schedule it with a timer trigger, connect to storage, or respond to webhooks, all from the same model.