Tag: Azure Functions

AzureEventsPersonal DevelopmentPostmortem

Postmortem for my Global Azure 2020 talk: Bringing serverless to the Enterprise

During my Global Azure Virtual 2020 live stream on Bringing serverless into the Enterprise, I had a few demo glitches. An inside joke for those that do presentations and demos is that the demo gods are either with you or against you. Some might say I didn’t offer up a satisfying sacrifice to the demo gods. I would argue and say I did but I feel it’s important to reflect and learn what went wrong and how I can be better prepared for the future by learning from our mistakes.

Prelude

So knowing that I presented on this topic for the Global Azure 2020 Virtual event and had some failed demos, I wanted to explain what happned and why and how to be better prepared for a future talk and hopefully it’s a lesson that you can learn from for your own talks, presentations or just development efforts.

Back in February 2020 I had submitted a few topics for the Global Azure 2020 event. At this point in time COVID-19 was going on but the world hadn’t shut down like it is today and the Global Azure 2020 event was still going to happen. In March I was notified that my topic was selected and I had about 6 weeks to prepare. Fast forward to mid March and everything was starting to be cancelled or made virtual. In the case of our local Global Azure 2020 event it was cancelled, so I didn’t work on my presentation. I was invited to participate in another Global Azure 2020 Virtual Community event in UK and Ireland so I focused on that content.

About 2 weeks prior to the Global Azure 2020 event, I was notified we would be making our local event virtual and I had to confirm if I still wanted to participate. At this point I was not prepared and my wife ended up signing up for a course over the weekend prior to the event – which left me with 3 kids (10 months, 4 yrs and 7 yrs) to manage for 10 hours each day over a 3 day weekend. My initial thought was to excuse myself from the event, but I really wanted to participate and with COVID-19 and everything halted, I found it was important to maintain that community connection even if it was a virtual event.

So this took me back to my college days of doing school, working and squeezing in a project over a tight deadline – not fun but with coffee as my partner, I got the kids to bed and started putting in a couple late nights to get it all done…or so I thought.

With my talk this year being on bringing serverless into the Enterprise, I focused on Azure Functions and my demos were on the following topics to illustrate common enterprise use cases:

  • Using PowerShell in a Azure Function for automation tasks
  • Deploy code to Azure using GitHub Actions
  • Avoiding cold start and latency with Premium Functions
  • Monitoring logs for your Functions

My PowerShell Azure Function Failure

My first failed demo was something I knew was being problematic going into the talk but I felt it was important to still talk about and I had screenshots of a working state from previous attempts so felt good to proceed. The demo was creating an Azure Function with PowerShell. The issue was that no matter what PowerShell command I tried to run, I kept getting errors that it could not be run successful as shown below and no matter what I did I kept getting an error that the subscription could not be set.

Because you never know if something will go off the edge during a demo, you should always be prepared to go ‘offline’. By that I mean show screenshots of what you were trying to do and the expected outcome. You could even go so far as recording your demo and then switching to that during your talk. I’ve never done this but I’ve heard some people have and it worked perfectly. The audience had no idea the demo was broken and they were able to convey their message.

That might be a bit extreme, but I usually do take some screenshots of the Azure portal as part of my notes I use to prepare the presentation, so I know I can always fall back to that if necessary and in this case that is what I did. It’s unfortunate I could not show the feature working as I intended, but I let the audience know and continue to roll along.

My Premium Function Failure

This was my favorite demo I prepared for the talk and it involved creating an Azure Function and hosting it on the Premium plan and then comparing that to the Consumption plan to show scale, latency and that there is no more cold start in Azure Functions with the Premium plan.

When I prepared this demo it was before I worked on the GitHub Actions demo – which would have come prior to this in my presentation. The order of the demos plays an important role in why this failed so I’ll come back to this later.

In order to show the cold start and latency issues with the Azure Functions Consumption plan and how the Premium plan avoids this I was using a load testing site called Loader.io. This tool required that the host URL be verified with a special token that had to be returned from the site. In order to map my Azure Function result to the expected URL that loader.io wanted I needed to configure and Azure Function Proxy.

I needed the following function URL http://ga2020-consumption-scale.azurewebsites.net/api/loaderio to return the verification token as if it was being called from this URL http://ga2020-consumption-scale.azurewebsites.net/loaderio-0cbce440ef982c13caba4130d3758183/.

When I was setting up the demo I first setup the proxy in the portal, and then I moved it so a proxies.json file in the Visual Studio solution as shown here

When I was testing this demo I was able to verify the token and use loader.io to load test my consumption and premium functions without issue. After getting this demo done I moved on to the GitHub Action demo and took a copy of the code and used that for the CI/CD to push it up into Azure and that demo worked without issue. When I tested the automated deployment, I just tested the function and not the load testing.

You may have an idea of what caused the failed demo, but if not it’s related to the proxies.json file. When I copied the file into my solution I forgot to go to the properties and mark it as content to be deployed. So in the GitHub Actions demo that took place prior to the load testing demo, it would have deployed a fresh copy and removed the Proxy I had originally setup in the portal. This meant that if I needed to validate the token from loader.io, I wouldn’t be able to and thus I saw the following error in my demo and was a bit surprised.

I didn’t have or want to take the time to live debug to find out what was wrong as I feared I would go down a rabbit hole and totally derail my talk. So I moved on and explained as best as I could what would have happened…again I have screenshots but it wasn’t as cool as showing it live.

Testing, rehearse and what went wrong

When I look back at that presentation, I had under 2 weeks to prepare and I was still working on the talk the morning of to finish up a few areas. I would not have left things to the last minute as I did but things were very fluid in Feb/Mar with COVID-19 and I wanted to put my best effort in for the community and felt I could still manage it but under not so ideal circumstances.

I worked on each demo individually as they weren’t really related except for the GitHub Action demo. I should have done that first because I would have caught the token verification issue right away due to the missing proxy.

Speaking of token verification, it would seem its valid for 24 hours and as I got close to the talk I didn’t want to warm up my functions as I wanted them in a cold state. So not testing them right before my talk I missed out on seeing that the token just expired, which would have shown me that the proxy was missing.

Due to the time crunch when I rehearsed I didn’t do my demos inline with the presentation, I did them separately. Again had I done the demos with the presentation I would have potentially caught the expired token and missing proxy. It’s important to do an end to end test and walk through of the presentation material regardless how comfortable you feel you are.

In retrospect I should have gone back and tried to troubleshoot this issue at the end of my talk. As soon as I looked at the function I noticed the proxy was missing and I was able to add it quickly which would have looked like this…

This would have only taken me 5 minutes to troubleshoot and fix which would have allowed me to show the real demo. All in all the talk went well and I got some really good feedback. No one complained about the broken demos and I mentioned that I would follow up with the blog post to show what was wrong and how I fixed it. I was a bit disappointed that I couldn’t show this demo live as its pretty awesome to see, so look for a future blog post where I’ll setup a Premium function and throw some load at it – maybe I’ll even record it and post to YouTube.

I hope you enjoyed this post and found something useful. I find it’s important to acknowledge when we do run into issues and how we solve them.

Enjoy!

References

Global Azure Virtual 2020 live stream on Bringing serverless into the Enterprise

AzureCloudCloud NativeDeveloper

AzUrlShortener: An open source, budget-friendly URL shortener | Azure Friday

In this episode of Azure Friday, Frank Boucher joins Scott Hanselman to talk about AzUrlShortener – an open source, budget-friendly URL shortener you can deploy directly from GitHub with one click into your Azure subscription. Frank explains how to get it, why it’s inexpensive, and explores the source code.

[0:01:34] – Demo

Source: Channel 9

Resources

AzureCommunityEvents

Speaking at Global Azure Virtual 2020

The Global Azure event has expanded to cover 3 days, April 23-25 and will be an online virtual event due to the Covid-19.

This year I will be speaking at 2 Global Azure Virtual events. The first is with the Global Azure Virtual 2020 UK & Ireland, where I will be contributing a recorded session on Exposing services with Azure API Management. This virtual event will have 50+ sessions with 20 live sessions over the course of the 3 days. The second is with Azure Virtual Community Day – Canada Edition where I will be doing a live stream on Bringing serverless into the Enterprise. This event will have 2 live tracks on Apps + Infrastructure and Data + AI and will have 12 sessions and 2 keynotes.

My first session on Exposing services with Azure API Management is happening on Friday April 24 09:00-10:00 UTC and the link to watch it is https://bit.ly/3aClNGx/.

My second session on Bringing serverless into the Enterprise is happening on Saturday April 25 15:00-16:00 EDT (UTC -4) and the link to watch the live stream is https://aka.ms/AzureCan2020-Track1-Afternoon.

I’m very excited to be speaking at these awesome community events and I really appreciate the opportunity to be part of this global community and share my passion for Azure. So

I hope you will join us on these days these to learn all about Azure from your world community.

Enjoy!

Resources

Global Azure Virtual 2020 UK & Ireland

Azure Virtual Community Day – Canada Edition

Global Azure Virtual 2020

Azure

Go serverless: Serverless operations with Azure DevOps | Azure Friday

In this episode of Azure Friday, Abel Wang joins Donovan Brown to show how to use Azure Pipelines to build and deploy apps for Azure Functions, App Service and even Kubernetes Clusters.

[0:00:45] – Demo

Source: Channel 9

Resources

AzureCloud NativeServerless

Azure Functions: Extend Execution Timeout Past 5 Minutes

Azure Functions is the Serverless compute option within the Microsoft Azure platform. One of the biggest benefits of Azure Functions, and Serverless …

Azure Functions: Extend Execution Timeout Past 5 Minutes
AzureCloud NativeServerless

Go serverless: Real-time applications with Azure SignalR Service | Azure Friday

Modern applications light up with real-time information. In this episode of Azure Friday, Anthony Chu joins Donovan Brown to show how to deliver live updates from Azure Functions to web, mobile, and desktop apps with Azure SignalR Service. Learn how to send real-time messages over WebSockets from your serverless apps with a few lines of code.

[0:03:00] – Demo

Source: Channel 9

Resources

AzureCloud NativeServerless

Go serverless: Event-driven applications with Azure Functions | Azure Friday

In this episode of Azure Friday, Jeff Hollan joins Scott Hanselman to show how you can quickly develop and deploy code to run in the cloud with Azure Functions. Functions can be written in a variety of languages, and will automatically trigger and scale based on your application needs.

[0:01:53] – Demo

Source: Channel 9

Resources

Azure

Azure Apps Demo Map is now live!

Source: Azure Apps Demo Map, Microsoft

Earlier this week I noticed that Microsoft launched the Azure Apps Demo Map website, a centralized way to see a some awesome resources available by Microsoft for building enterprise applications that leverage Azure technologies..

Most of the scenarios include an interactive user experience to explore the solution – including solution diagrams, live demos, source code and additional resources.

When exploring a scenario you can click on sections to see what technologies were used for that particular application. In the case of the Rewards application, it uses Azure Functions, Logic Apps, and App Service.

After exploring the interactive model you can head over to the GitHub project to download and run the code so that you can dig really deep in how the solution was built.

Let’s take a brief look at each of the projects.

Projects

Currently the Azure Apps Demo Map contains four applications as listed below.

Tailwind Traders

Tailwind Traders is a fictitious retail company showcasing the future of intelligent application experiences. These reference apps are all powered by the Azure cloud, built with best-in-class tools, and made smarter through data and AI.

Source: Azure Apps Demo Map, Microsoft

Visit the GitHub Project

SmartHotel360

SmartHotel360 is a fictitious smart hospitality company showcasing the future of connected travel. Their vision is to provide an intelligent and personalized experience to the guests.

Source: Azure Apps Demo Map, Microsoft

Visit the GitHub Project

Rock, Paper, Scissors, Lizard, Spock

The geek version of the classic game. This sample shows a multilanguage application running on AKS with a front-end developed in Blazor and integrated with Azure Machine Learning and Azure Cognitive Services. Start the battle and find if you can beat our bot! VISIT PROJECT

Source: Azure Apps Demo Map, Microsoft

Visit the GitHub Project

Contoso Air

Contoso Air is a fictitious airline company. This lab shows how to create a website application that runs Node.JS Server that stores customer booked flights in an Azure Cosmos DB.

Unfortunately this project has no diagram and has been archived. However this project still contains valuable information for building a Node.JS + Cosmos DB application and running it on Azure.

Visit the GitHub Project

Wrap-up

This is a great resource to learn how Azure can be used for an end to end solution for your business.

They have a feedback link so if you found the resource useful or you have suggestions please let them know. It would be cool to see this resource be expanded to include other applications that include Power BI, Power Apps, Azure DevOps, Dynamics, etc.

Enjoy!

References

https://azureappsdemomap.com/

https://azure.microsoft.com/

AzureDeveloperDevelopment

25 days of serverless

Azure Advocates’ 25 Days of Serverless

December 1st sparks the start of Microsoft’s 25 days of serverless challanges. Each day throughout the month of December a new challenge will be published from the Microsoft Cloud Advocates. Your goal is to solve it in the programming language of your choice and then submit your solution via GitHub.

If you don’t know anything about Azure or serverless then no problem. Each challenge will provide hints to get your started

The Premise

Oh no! An evil grinch has stolen all of the world’s servers! Travel around the world helping everyone replace their current solutions to common tasks with serverless technology in time for the holiday rush.

Each day’s puzzle will bring you to a new location somewhere in the world! You’ll be helping local folks in that location with some problem they have, showing how moving to serverless can help things get done! Each day’s puzzle will bring you to a new location somewhere in the world! You’ll be helping local folks in that location with some problem they have, showing how moving to serverless can help things get done!

Join the Microsoft @AzureAdvocates and puzzle solvers all over the world for #25DaysOfServerless adventures!

Enjoy!

References

https://25daysofserverless.com/

https://dev.to/azure/merry-and-bright-with-azure-advocates-25-days-of-serverless-1hi0

Azure

Getting started with Azure Event Grid Extension for Visual Studio Code

I love Visual Studio Code and all the extensions that are available. It has become my preferred editor for almost everything (replacing Notepad++), except for when developing in Visual Studio.

Recently there is a new extension that was made available for working with Azure Event Grid. Typically when working with Azure Event Grid I use a tool called Postman to send test messages to my Azure Event Grid resource. But now with this latest extension you can use Visual Studio Code.

In this post I’ll walk through how to get started and use the Azure Event Grid extension for Visual Studio Code. Let’s get started.

Prerequisites

Before we can begin we need to make sure we have the following installed and setup:

  1. An Azure Subscription. If you don’t have an Azure Account, you can sign up for one today for free and receive $200 in credits by selecting "Create a Free Azure Account…" or selecting "View->Command Palette" and searching for "Azure: Create an Account"
  2. Install Visual Studio Code
  3. Visual Studio Code Extensions:
    • Install extension Azure Tools for Visual Studio Code
    • Install extension Azure Event Grid

Connecting to your Azure Subscription

First thing we need to do is connect to your Azure subscription. This will happen automatically when you go to the Azure tab in Visual Studio Code. You can also sign in from the Command palette and searching for “Azure: Login”.

image

image

image

Create an Event Grid Topic

Now that you’re signed in, let’s go ahead and create an Event Grid topic.

1. In the Event Grid Topics pane, click on the + button to create a new topic:

image

2. Then select your Azure Subscription to associate this topic with:

image

3. Now provide a topic name. I will use “VSCodeEventGridTopicDemo” for my demo:

image

4. Next select a resource group for your topic. I will use  “RGVSCodeEventGridDemo” for my demo:

image

5. Select your location for the resources:

sshot-636

6. Done. In a few seconds your Azure Event Grid will be created and displayed in Visual Studio Code:

image

image

You can login to your Azure Subscription and see everything we just created. Keep your Azure Subscription loaded in the browser as we’ll use it for the next section.

image

Create Event Grid Subscription

Now that we have an Event Grid Topic setup we need to create a subscription to receive the events we send it.

1. Here I will create a new Azure Function app:

image

2. Now create a new Event Grid Trigger function and after it’s created click on the Add Event Grid subscription link:

image

3. Fill in the details relating to the Azure Event Grid Topic we created earlier and then press the Create button:

image

Your Event Grid Topic now has an Event Grid Subscription and is ready to test!

Generating Mock Events

Apart from managing your Event Grids resources in Visual Studio Code, you can also generate and send mock events which is great for testing purposes. Instead of using Postman to do this, I find the Event Grid Extension better and mocking and sending events. So let’s get started now mocking some events.

1. To generate a mocked event, right click on your Event Grid Subscription in Visual Studio Code and select Create Mock Event Generator:

image

2. A new file will be created with all the details for generating mocked events for this subscription. The pattern property is defined with regex patterns for generating random data. You will noticed I changed the data section pattern value with regex pattern to generate the mocked data for my event:

image

3. At the top of the event generator file will be two links: Send Events and Preview Events. The actions do exactly as they say and are what you want to use when generating your mocked events.

image

4. If we click on Preview Events, another file is created with a preview of mocked event data to be sent. Notice the different values between the events. This is from the regex logic defined in the event generator. This can be customized to generate data appropriate for your needs.

image

5. Now click on Send Events link at the top of the event generator file and go to your Azure Portal where you previously defined your Azure Function for your Event Grid Topic, and you will see in the logs your mocked events:

sshot-647

As you can see the Azure Event Grid extension for Visual Studio Code is very powerful and is a handy tool to use in your Azure development.

Enjoy!

Reference

Create your free Azure account

Azure Event Grid Overview

Azure Event Grid Documentation

Introduction to Azure serverless with Azure Functions, Logic Apps and Azure Event Grid