DEV Community

Cover image for Azure Serverless Apps in 10 minutes
John Peters
John Peters

Posted on • Updated on

Azure Serverless Apps in 10 minutes

Azure had made it easy to create serverless applications. They have named the serverless apps to "Functions" of which, there are two parts. First the Azure portal has an icon like this:

To create the function "host" in the cloud. In your Azure portal click on this icon.

Alt Text

From there click on Create...

Alt Text

You will see this screen:

Alt Text

The billing part of this is the subscription and the resource group. If you don't have a resource group you can click create new which merely asks for a name.

Runtime Stack

Alt Text

Here we see a runtime stack selection of .NET Core; however, there are many other stacks such as node.js which may be used.

✔️ Good so far, this sets up our portal side, look at this part as the definition of the container for our functions that will be published.

Create the Function

Back to the code side. We will use Visual Studio to create the function being that it will be in C#.

Open up Visual Studio and install or update 'Azure Functions'

Create a new project in Visual Studio

Select the Azure Functions Template

Alt Text

On the next screen "Configure your new project" set the name, location, solution, and solution name. Note: You may add this to another existing solution too.

Select HTTP trigger on next screen.

Alt Text

The Function Code

After clicking the 'Create' button shown above, the templated code will look like this:

Alt Text

Publish to Azure

Click on the BUILD tab in Visual Studio and select the option shown below.

Alt Text

Select Azure

Alt Text

Choose the Function Instance (container in Azure)

Alt Text

✔️ Done

To access the endpoint the url pattern is: /yourdomian/api/FunctionName in the url.

Conclusion
The term serverless is somewhat misleading because we had to tell it the server configuration, location etc. The 'serverless' part is that is was easy to do that, and we are only interested in using the new endpoint. From that perspective it is serverless with respect to maintain the platform function run. Perhaps the best part is that we can spin up a new function in 10 minutes.

JWP2021

Discussion (0)