Microsoft 25 Days of Serverless 2019 submissions

Another year is coming to an end. Waking up on Monday the 2nd of December and checking my socials I saw announcements from the Microsoft Developer Advocates of a 25 Days of Serverless challenge.

25 Days of Serverless Dev Advocates annoucement.PNG

Being also very immersed in the craft beer industry December for me is normally marked with craft beer advent calendars (a case of mystery beers with each to be opened on the respective day). So 25 Days of Serverless challenges is quite refreshing.

Living in Australia means that we are ahead of most of the world, so Monday morning I saw not only the first, but also the second challenge.

I’ll update this page with each submission I complete in the 25 Days of Serverless challenge. I hope to be able to complete all 25. All will also be posted to this Github Repo.

Challenge / Day 1

Your task for today: create a REST API endpoint that spins a dreidel and randomly returns נ (Nun), ג (Gimmel), ה (Hay), or ש (Shin). This sounds like a great opportunity to use a serverless function to create an endpoint that any application can call!

Using PowerShell I created an Azure HTTP Trigger PowerShell Function. I’ve previously used PowerShell Azure Functions extensively, but predominantly v1. I hadn’t written an Azure PowerShell Function since v2 PowerShell Functions went GA a few months back. So a great reason to use PowerShell for my submission.

For my submission I added a query to allow you to call the API with “slow”, “medium” or “fast” for the spin speed. That generates a random number between an upper and lower integer for the number of random times a result is generated and then the highest result is returned as the final result along with a spin time (number of calls to the random result).

The screenshot below shows the results for a fast, medium and slow spin. GitHub link for my Azure PowerShell Function is here.

25 Days of Serverless - Challenge - Day 1 - Azure Function Rest API.PNG

Challenge / Day 2

Create a task scheduler that will tell Lucy exactly when she should relight candles, pour coffee into cups, and deliver batches of coffee. How you want to notify Lucy is up to you: maybe you can send her an SMS via Twilio, or build a webapp that uses WebSockets and browser notifications?

For this challenge I used Microsoft Power Automate (fka Microsoft Flow). I did think about using Azure Functions again and messing with Durable Functions, a Web App and SignalR. But I quickly realised that was over engineering the problem and I didn’t have time to learn Durable Functions and SignalR in the hour or so I had available to completed the submission.

I’d used Microsoft Flow a few times so it was quick to create a manual trigger (that then shows up as a Button on the Power Automate mobile application on iOS) that then steps through the series of notifications and delays to allow the tasks to be completed.

25 Days of Serverless - Challenge - Day 2 - Power Automate .PNG

With the Power Automate iOS app installed triggering this flow with the Button trigger in the mobile app, iPhone and Apple Watch notifications remind Lucy of the tasks and sequence.

This slideshow requires JavaScript.

GitHub link for my Azure Power Automate Flow is here.