October 17th, 2018

Serverless computing on Azure Government with Functions

Yujin Hong
Program Manager

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. You can easily connect to data sources such as Azure Storage or Cosmos DB and integrate triggers and bindings, allowing your defined functions to process and react to events. Azure Functions is scale-based and on-demand, so you pay only for the resources you consume. In this blog we will introduce a Functions sample running on Azure Government, utilizing the magic of serverless computing.

The video below shows several examples of working with Azure Functions in Azure Government. Specifically, we’ll show a simple HTTP call, and storage trigger, and a GitHub web hook. These examples show how quick and easy it is to get up and running, then then the final example will show using Visual Studio – including local debugging – to develop an app using Azure Functions.

Our  sample consists of a Functions app and the Azure Gov Moderator, an ASP.NET Core web application running in Azure Government that allows moderation of images that users upload to the system. For our sample scenario, if the user uploads an image of a car, the image will be approved, if not – rejected.

When a user uploads an image to the Moderator, the image will be stored in Azure Blob storage and a message sent to an Azure Queue. We have implemented a Queue trigger in our Azure Function, which runs as a response to this upload. The status of the image is initially set to “Pending”, as it has not been confirmed to be an image of a car. Our function will now run make a call to the Computer Vision API and retrieve the caption to see if this image contains a car. The status will be updated appropriately and stored in a Cosmos Database.

We have shown how easy it is to get started with Azure Functions in a simple scenario. You can try this out yourself by going through and setting up the functions sample on Azure Government!

How to run the Azure Government Functions sample (Video)

Also, be sure to subscribe to the Microsoft Azure YouTube Channel to see the latest videos on the Azure Government playlist.

 

Author

Yujin Hong
Program Manager

0 comments

Discussion are closed.