Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Azure icon
Labs

Using Azure Functions with C#

In this lab, you will gain experience using C#, Visual Studio, and Azure Functions. You will build an Azure function using C# code that is triggered by a webhook and saves data to Azure Table storage using a Table storage binding. You will then run a console application to see everything working and will verify that table data was saved using Azure Storage Explorer. Finally, you will check the Azure portal to ensure telemetry data was saved to Application Insights. Upon completion of the lab, you will have gained the experience required to work with Azure Functions using C#.

Azure icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 0m
Published
Clock icon Jan 28, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create Function and Application Insights in the Azure Portal

    1. Review the lab-provisioned resources.
    2. Take note of the resource group location and the 5 character suffix for all of the deployed resources. These will be used later in the lab.
    3. Create a new function app.
    4. Once deployed, enable Application Insights.
  2. Challenge

    RDP into the VM, Configure Storage Explorer, and Open the Visual Studio Solution

    1. Download the RDP file for the lab-provided VM.
    2. Connect to the VM, clone the Azure labs repository, and extract from it the solution file for the lab.
    3. Download and install Azure Storage Explorer.
    4. Configure storage explorer using resources created in the lab.
    5. Open the extracted solution file to start Visual Studio.
  3. Challenge

    Update and Run Visual Studio Solution, Verify Table Data using Storage Explorer, and Verify Application Insights Data

    1. Using Visual Studio, update the local.settings.json and Functions1.cs files with information copied during previous lab objectives as well as the following code:

      public static class Function1
      {
          [FunctionName("Function1")]
          [return: Table("<TABLE_NAME>", Connection = "StorageConnectionAppSetting")]
          public static SampleData Run(
              [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]
              HttpRequest req,
              ILogger log)
          {
              log.LogInformation("C# HTTP trigger function processed a request.");
      
              string name = req.Query["name"];
      
              return new SampleData()
              {
                  PartitionKey = "Http",
                  RowKey = Guid.NewGuid().ToString(),
                  Text = name
              };
          }
      }
      
      public class SampleData : TableEntity
      {
          public string Text { get; set; }
      }
      
    2. Run the updated function.

    3. Using a web browser, test the updated function.

    4. Verify the data is stored in the table successfully using Azure Storage Explorer.

    5. Review the telemetry data using Application Insights.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans