Skip to content

NoahSamson/AzureWorkshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Azure Fundamentals Workshop 2017 - IIT

Sample code and instructions for Azure Workshop 2017 done at IIT

Prerequisite

You need the following prerequisite in order to perform the hands-on activities during the workshop.

  • Azure Subscription (Trial Subscription is enough)
  • Visual Studio Community 2017
  • GitHub Account (With this sample project code pushed to a repository of your own)

Azure Subscription

You can create a Trial Azure Subscription to follow the hands-on demos during the workshop. Follow the instructions below to create the subscription. You will need a Microsoft Account to proceed.

Note: You will need a Credit/Debit Card to complete the subscription creation process. You will not be charged. It's for identity verification.

Visual Studio Community 2017

You need to download the Visual Studio Community 2017 edition and install on your development machine to work on hands-on demo. You can sign in to Visual Studio Community 2017 instance using the Microsoft Account you created in the earlier step.

GitHub Account

Create a GitHub account and create a repository. Then push this sample code project to the new repository you just created in your own GitHub account. We will be using it to host a web application on Azure

IIT Azure Workshop 2017 Sample Application

The sample application is a ASP.Net MVC Application created using the default template come with Visual Studio 2017. The solution contains 2 projects.

  • IITAzureWorkshop.Web - ASP.Net MVC Application
  • IITAzureWorkshop.Functions - Azure Functions application

IITAzureWorkshop.Web

In addition to the default pages of the application. An additional Order page is added. This contains the UI to create a simple order that will send an email to the buyer using Azure Functions application. There are 2 *AppSettings you need to configure to use this app.

  • AppTitle - Title of the application that shows up in the home page
  • StorageConnection - Connection string for the Azure Storage Account. (Using this for putting the order in to the Azure Storage Queue)

IITAzureWorkshop.Functions

Azure Functions project with the pre-compiled function SendOrderConfirmation which is a Queue Triggered function with a SendGrid output binding for sending emails using SendGrid email service.

Sample Code for Azure Function Created using the Azure Portal

During the demo we will create an Azure Function using the Azure Portal. The sample code for that function is given bellow.

#r "SendGrid"

using System;
using SendGrid.Helpers.Mail;

public static void Run(Order order, TraceWriter log, out Mail email)
{
    log.Info($"C# Queue trigger function processed: {order.Id}");

    var personalization = new Personalization();
    personalization.AddTo(new Email(order.Email));

    var messageContent = new Content("text/html", string.Format("Dear {0}, The {1} x {2}(s) you ordered is processing. Thank You for Ordering", order.CustomerName, order.Quantity, order.Product));

    email = new Mail();
    email.AddPersonalization(personalization);
    email.AddContent(messageContent);
    email.Subject = "Order Processing";
    email.From = new Email("[email protected]");
}

public class Order
{
    public Guid Id { get; set; }
    public string Email { get; set; }
    public string CustomerName { get; set; }
    public string Product { get; set; }
    public int Quantity { get; set; }
}

About

For a workshop at IIT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published