Tag: Azure Functions

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

AIAzureDevelopmentEventsProductivity

Microsoft Build 2018–Day 2 Highlights

Today’s keynote by Joe Belfiore was focused on Multi-sense + Multi-device for Microsoft 365, which is Windows, Office and EMS

Image showing how Microsoft 365 brings together Office 365, Windows 10, and Enterprise Mobility + Security (EMS), a complete, intelligent, and secure solution to empower employees.

Announcements

  • Fluent Design System updates.
  • UWP XAML Islands, which lets you incorporate UWP into WinForms, WPF and Win32 applications. This also means you can start to bring in the Fluent Design System into these UI frameworks.
  • Windows UI Library, which brings native platform controls as NuGet packages instead of being tied to the OS version. This will work from the Windows Anniversary Update and newer.
  • .NET Core 3.0, which will support side-by-side runtimes, along with support for WinForms, WPF and UWP.
  • MSIX, which is dubbed the best technology for installing applications on Windows. This inherits the Universal Windows Platform (UWP) features, works across Enterprise or Store distributions, and supports all Windows applications.
  • Windows SDK Insider Preview – https://aka.ms/winsdk
  • New developer revenue sharing model. Developers will get 85% when their app is found in the Microsoft store, and 95% when you provide your customers to your app in the Microsoft store.
  • Microsoft Launcher on Android will support Timeline for cross-device application launching. On iOS this will be supported through Microsoft Edge.
  • A new “Your Phone” experience coming soon to Windows 10 that enables you to see your connected phone text messages, photos and notifications and then interact with them without having to use your phone. Really neat experience – now if only they support Windows Mobile 10 Smile
  • Microsoft Sets was officially shown and demonstrated how it can be used for an easier way to organize your work and allow you to get back to work where you left off when ready. This means not having to have 25+ tabs open in Chrome or Edge. Nice!
  • Adaptive Cards is being added to Microsoft 365, which will enable developers to create rich interactive content within conversations. They demonstrated a GitHub Adaptive Card for Outlook (365) where you could comment and close an issue. Another example shown was paying for your invoice from an email.
  • There was a lot of buzz for Microsoft Graph, which is core to the Microsoft 365 platform. Microsoft Graph helps developers connect the dots between people, schedules, conversations, and content within the Microsoft cloud.
  • Cortana and Alexa start speaking to one another. Sometime in the future you will be able to access your Alexa device through Windows 10 and likewise on an Amazon Echo you will ne able to speak to Cortana.

Enjoy!

References

https://developer.microsoft.com/en-us/events/build

Modernizing applications for our multi-sense, multi-device world

Microsoft 365 empowers developers to build intelligent apps for where and how the world works

AIAzureDevelopmentEventsProductivity

Microsoft Build 2018 – Day 1 Highlights

This is my first attendance at the annual Microsoft Build conference taking place in Seattle, WA. I have to tell you that so far I’m not disappointed. Here are some of the highlights from today’s events:

  • Azure is becoming the world’s computer: Azure | Azure Stack | Azure IoT Edge | Azure Sphere.
  • Azure IoT Edge runtime which runs on Windows or Linux is now being open sourced.
  • Microsoft showed off Cortana and Alexa integration which was pretty cool.
  • New Azure AI infrastructure announced: Project Brainwave which is a real-time AI on cloud and edge devices.
  • Announced Project Kinect for Azure, an Azure AI-enabled edge device.
  • Visual Studio Live Share is now generally available. This provides real-time collaborative development, shared debugging, independent views and works across Visual Studio and Visual Studio Code (Windows, Mac and Linux).
  • Azure Event Grid is getting new improvements like dead lettering (DLQ) and custom retry policies. Event Grid is also adding new event publishers for Azure Media Services and Azure Container Registry, and new event handlers for Storage Queue and Relay Hybrid Connections. Finally Azure Event Grid is providing an alternative form of endpoint validation. Event Grid provides reliable event delivery at massive scale (millions of events per second), and it eliminates long polling and hammer polling, and the associated costs of latency.
  • Azure Cosmos had some interesting updates like the new multi-master write support. It also provides API support for MongoDB, SQL, Table Storage, Gremlin Graph, Spark, and Casandra.
  • Azure Search now integrates Azure Cognitive Services to provide built-in enrichment of content using AI models, and it enables immersive search experiences over any data.
  • The Fluent Design System which Microsoft first debuted at Build 2017, is expanding beyond Universal Windows Platform (UWP) apps and will be available for Windows Forms, WPF and native Win32 applications.
  • Windows Timeline is coming to iOS and Android.
  • Azure Functions updates: Durable Functions reaches general availability, and Azure Functions now leverages the App Service Diagnostics.
  • .NET Core 3.0 and .NET Framework 4.8 announced were announced, and .NET Core 3.0 is coming to desktop development (awesome!)
  • Visual Studio 2017 version 15.7 and the next update version 15.8 preview 1 were released.
  • Visual Studio App Center integration with GitHub.
    • Visual Studio IntelliCode announced, which brings you the next generation of developer productivity by providing AI-assisted development.

    This already feels like a lot but really it’s just scratching the surface. I’m looking forward to what is announced today in the keynote followed by more technical workshops and sessions.

    Enjoy!

    References

    https://developer.microsoft.com/en-us/events/build

    Azure

    Comparing Azure Functions Runtime Versions

    image

    Azure Functions now have 2 different runtimes, version 1 which is what is currently in production and the only runtime supported for production use, and version 2 which is currently in preview. I’ll cover the difference in both runtimes and when to use which version.

    Overview or Version 1

    The version 1 runtime is what is currently used in production and is the only version supported for production use. This runtime is based on .NET Framework 4.6 and only support Windows for development and/or hosting in the portal. Version 1 also only supports the following languages: C#, JavaScript, and F#.

    What’s New in Version 2

    Version 2 runtime has been rebuilt from the ground up on .NET Core 2.0 and support cross platform (Windows and Linux) for deployment and for development you can use Windows, Linux, and macOS.

    Version 2 introduces language extension model that both JavaScript and Java are taking advantage of. There is also expanded language support for Java and more coming. We also have new bindings for Microsoft Graph and Durable Functions.

    Azure Functions is a great serverless offering and provides lots of functionality for almost any application. If you need to run code in production than version 1 is your only choice, but if you want to try out Azure Functions then definitely take a look at both runtimes. With Microsoft annual developer conference Build next month, I bet we will hear more information about version 2 runtime and a timeline for release.

    Enjoy!

    References

    Azure Functions runtime versions overview

    Install Azure Functions Core Tools

    Azure Functions Roadmap

    Azure

    Introduction to Durable Functions

    Durable Functions is a new extension of Azure Functions which manages state, checkpoints and restarts for you. Durable Functions provide the capability to code stateful functions in a serverless environment. This new extension enables a new type of function called an orchestrator. The primary use case for Durable Functions is to simplify complex, stateful coordination problems in serverless applications. Some advantages of an orchestrator function are:

    • Workflows are defined in code. This means no JSON schemas or designers are needed.
    • Other functions can be called synchronously or asynchronously. Output from functions can be saved to local variables.
    • Automatic checkpoint the progress of the function whenever it awaits. This means local state is never lost if the process recycles or the VM reboots.

    The following are 5 sample patterns where Durable Functions can help.

    Pattern #1: Function Chaining

    Function chaining is the execution of functions in sequence where the output of one function is the input to another function. With this pattern you typically use queues to pass state from function to function.

    Function chaining diagram

    Pattern #2: Fan-out/Fan-in

    Fan-out/Fan-in refers to the execution of multiple functions in parallel and then waiting for all of them to finish. This pattern also uses queues to manage state from start to end. Fanning back in is much more complicated as you would have to track the outputs of all the functions waiting for them to finish.

    Fan-out/fan-in diagram 

    Pattern #3: Async HTTP APIs

    Async HTTP APIs pattern is all about the problem of coordinating the state of long running operations with external APIs. With this pattern you often use another status endpoint for the client to check on the status of the long running operation.

    HTTP API diagram

    Pattern #4: Monitoring

    The Monitoring pattern is a recurring process in a workflow where the function polls for a certain condition to be met. A simple timer trigger could address this but its interval is static and management of it is more complex.

    Monitor diagram

    Pattern #5: Human Interaction

    Finally we have the Human Interaction pattern. This pattern is where a function executes but its process is gated based on some sort of human interaction. People are not always available or respond in a timely manner which introduces complexity to your function process.

    Human interaction diagram

    In all five use cases, Durable Functions provides built-in support for easily handling these scenarios without the need extra resources likes queues, timers, etc for managing state and controlling the function flow. For more information on each of these patterns and code samples please see the Durable Functions documentation.

    Durable Functions is currently in preview and is an advanced extension for Azure Functions that is not appropriate for all scenarios. Next month is the annual Microsoft developer conference Build. I suspect we’ll see some new exciting details with Azure Functions and Durable Functions specifically. Hopefully they become generally available.

    Enjoy!

    References

    Overview of Azure Functions

    Durable Functions Documentation

    AzureEducation

    Introducing Azure for Students

    Today Microsoft has announced that they will be offering a free $100 annual credit + 25+ free products to eligible students to help encourage them to build cloud apps for Azure and you pay nothing.

    Today’s students are the developers of tomorrow

    For students seeking the skills leading to the most opportunity for cloud based careers, Azure offers students and educators across the world the resources they need.

    This offer is different compared to the current free Azure Credits offers in that no credit card is required, students simply verify their student status to take advantage of this offer. In addition to this free credit, students can also get 750 Hours of Linux Virtual Machines, 250GB of SQL Database, 10 mobile or web apps, 1 million Azure Function requests and so much more.

    sshot-390

    Get started today and activate your credits at https://azure.microsoft.com/en-us/free/students/#free-products-section

    Enjoy!

    References

    https://azure.microsoft.com/en-us/free/students/

    https://azure.microsoft.com/en-ca/education/

    AnalyticsAzure

    Monitoring and Scaling your Azure Functions

    Everybody loves Azure Functions. My team recently deployed a production service using Azure Functions as the back end backbone. I’d like to share some lessons and tips we learned along the way. We’re using Azure functions in consumption plan – which basically means the platform scales in and out as required without our intervention. But […]

    via Monitoring and Scaling Azure Functions — 4pp1n51ght5