Tag: Visual Studio Code

AIAzureDevOps

Writing code and having fun with Rock, Paper, Scissors, Lizard, Spock | Azure Friday

In this episode of Azure Friday, Isaac Levin joins Scott Hanselman to talk about building highly scalable applications and having fun with the Rock, Paper, Scissors, Lizard, Spock sample application. Rock, Paper, Scissors, Lizard, Spock is a multi-language application built with Visual Studio and Visual Studio Code, deployed with GitHub Actions and running on Azure Kubernetes Service (AKS). It also uses Machine Learning and Azure Cognitive Services (Custom Vision API). Languages used in this application include .NET, Node.js, Python, Java, and PHP.

[0:01:55]

Source: Channel 9

Resources

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

AzureDevelopment

Azure Tools Extension for Visual Studio Code

Came across an awesome Visual Studio Code extension called “Azure Tools for Visual Studio Code” by Brady Gaster. Check it out!

This extension for Visual Studio Code gives Azure developers some convenient commands for creating or accessing resources directly in the editor.

Features

  • Search the Azure QuickStart Templates GitHub repository
  • Download Azure Resource Manager (ARM) template and parameter files to workspace
  • Uses the Azure Resource Manager Tools extension to simplify the template-editing experience
  • ARM template deployment to live Azure subscription
  • Login with Microsoft Account (@hotmail.com, @live.com, etc.)
  • Login with Azure Active Directory (or "Organizational") account
  • Create App Service Web Apps
  • Create App Service Function Apps
  • Create Storage Accounts
  • Get Storage Account connection string
  • Browse to resource in portal
  • Browse to resource group in portal
  • Support for multiple Azure subscriptions
  • Supports all Azure data centers

Each of these commands is visible directly from commands visible in the command palette.

Installation

Azure Tools Extension for Visual Studio Code can be installed from the built-in extension tab in Visual Studio Code. Just search for “Azure Tools” and it will be the first result. Click on the extension and then click on the green “Install” button.

image

This extension is available as an open-source project and can be found in the GitHub repository https://github.com/bradygaster/azure-tools-vscode.

Enjoy!

References

Announcing the Azure Tools Extension for Visual Studio Code