Tag: Azure Functions

AzureDevelopment

Real World Usage for Azure Functions

Came across an excellent blog post from @TroyHunt on using Azure Functions to track abusive IP addresses to a website and log them to an Azure storage account and then have another Azure Function on a timer to validate those IP addresses and block them if necessary.

https://www.troyhunt.com/azure-functions-in-practice/

Enjoy!

CloudDevelopment

Getting Started with Azure Functions

The first article of this series, Introduced what Azure Functions are and the capabilities they offer when used by themselves or combined with other Azure resources. This article will focus on getting started with just one of the types of Azure Functions available…the HttpTrigger function.

Creating the Azure Function

You can quickly get started with creating an Azure Function by going to the Azure Functions Get Started Portal. After logging in you will be taken to the Azure Functions getting started portal as shown below.

Portal1

Using the above Getting Started portal, enter the name and location of your Azure Function app, in my case I’m using a name of  GettingStartedAzureFunction and a location of East US.

Then then click on Create + get started button. This will then take you to the Azure portal inside your Azure Function app. From here you can get started quickly with a premade function, in my case I went with Webhook + API, and C# for the language. Finally click on the Create the function button to create this function.

AzureFunctionAppBlade-01

A new function named HttpTriggerCSharp1 will be generated for you, which will be based on C# and this function will be run whenever it receives an HTTP request.

HttpTriggerFunction-Code

At this point your function is ready to go. You can see the Function URL at the top and below is the generated code for the Http trigger.

Testing your Function

Since this function is generated from the quick starts, it already contains functional code which you can immediately run and test.

In this example you can quickly test the function by clicking on the Run button at the bottom of the page. It will pass a request body with the named parameter of “Azure” to the function, which will then show up in the Output pane to the right.

HttpTriggerFunction-Run

Alternatively you can also test the function by browsing to the URL to trigger the function. In this case I’ll navigate to the URL provided and the pass in the parameter name of “callon” to the query string like so.

HttpTriggerFunction-Test2

Monitoring your Function

Now that your function is up and running you can easily monitor it by going to the Monitor tab of your function. From here you can see recent success and error counts and inspect the function requests.

HttpTriggerFunction-Monitor

Managing your Functions

After creating your Azure Function app, you will be taken to your Azure Function app blade where you can create and manage your functions. If you need to get back to your Azure Function apps at a later time, you can navigate to the App Services blade and then filter by function as shown here.

AppServices-AzureFunctions

Next Steps

Now that you have your Azure Function you will most likely want to integrate it into other Azure resources or other apps. If you click on the Integrate tab of the function, you can quickly define an integration (triggers, inputs and outputs) and there is also an advanced editor available if needed.

HttpTriggerFunction-Integrate

Lastly if you scroll down on the Integrate tab, you will come to some handy documentation.

HttpTriggerFunction-Integrate2

In a future post I will walk through integrating an Azure function with another Azure resource.

Enjoy!

References

Azure Functions
Azure Functions Documentation
Testing Azure Functions

CloudDevelopment

How to Upgrade an Azure Function App

After creating an Azure Function app, you may notice a notification in your Azure Function app tat there is a new version of Azure Functions. I’ll walk you through the current process for upgrading your Azure Function app.

Upgrading

To start the upgrade process, click on link “Function app settings”:

Function App Settings 1

Then click on “Update”:

Function App Settings 2

Within a second your Function app should be upgraded to the latest version:

Function App Settings 3

That’s all that is required when upgrading your Function apps.

Enjoy!

CloudDevelopment

Introduction to Azure Functions

What is Azure Functions2

Azure Functions are a serverless, event driven experience that extends the existing Azure App Service platform, by building “nanoservices” that can scale based on demand and you only pay for the resources you use.

functionsAzure 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.

Supported Languages and Tools

Azure Functions can be created in C#, Node/JavaScript, Python, F#, PHP and scripting languages like Bash, Batch and PowerShell. You can even run executables.

Common Scenarios

Azure Functions is a great solution for building nanoservices, simple API’s, processing data and integration with systems. Here are some common scenarios for Azure Functions:

  • Timer-based processing
  • Azure service event processing
  • SaaS event processing
  • Serverless web application architectures
  • Serverless mobile backends
  • Real-time stream processing
  • Real-time bot messaging
sshot-306
Integrations

Azure Functions can be triggered by virtually any event in Azure, any 3rd party services, or any on premise systems. The following service integrations are supported by Azure Functions:

  • Azure DocumentDB
  • Azure Event Hubs
  • Azure Mobile Apps (tables)
  • Azure Notification Hubs
  • Azure Service Bug (queues and topics)
  • Azure Storage (blob, queues and tables)
  • GitHub (webhooks)
  • On-premises (using Service Bug)
Getting Started

You can quickly get started with creating an Azure Function by going to the Azure Functions Get Started Portal. After logging in you will be taken to the Azure Functions getting started portal as shown below.

Portal1

Or create a function app from Azure Portal. This can be found under New –> Web + Mobile –> Function App:

FunctionApp-Portal2

Once you’ve created your Function App, you will be taken to the Function App blade in the Azure Portal. From this blade you can create new functions by clicking on the New Function button on the top left, which will bring us to pre-built templates. If you click on an existing function, which are listed along the left side, you can edit the function, look at logs and even test the function.

Portal2

Have fun and take a look at Azure Functions and how they might help you. In my next post I’ll dive deeper and walk you through creating, running and testing the function app.

Enjoy!

References

Azure Functions
Azure Functions Documentation
Build 2016 Video: Introducing Azure Functions