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

Create an Azure Function to Listen to Blob Created Events

In this hands-on lab, we use the Azure portal to create an Event Grid-triggered Azure Function that will be invoked when a blob is created in a storage account.

Azure icon

Path Info

Clock icon Intermediate
Clock icon 45m
Clock icon Feb 28, 2020

Contact sales

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

Table of Contents

  1. Challenge

    Log In to the Azure Portal

    Log in to the Azure Portal using the username and password supplied by the lab.

    1. Open a browser.
    2. Navigate to the provided Azure portal URL.
    3. Use the supplied username and password to authenticate.
  2. Challenge

    Create the Event Grid-Triggered Function

    Starting in the Azure dashboard perform the following tasks:

    1. Open the navigation menu in the upper-left of the Portal.
    2. Click All resources. Wait for all the resources to appear.
    3. In the list, click on the app service that has a name that starts with fa-. This will open the overview page of the function app service.
    4. In the left-hand panel, select Functions right under the Functions section.
    5. In the panel that appears on the right of the page, select Azure Event Grid Trigger from the template list.
    6. In the New Function panel that appears on the right of the page, enter "MyEventGridTriggerFunction" as the name*.
    7. Click Create.
    8. Wait for the function to appear.
  3. Challenge

    Create the Event Grid Subscription

    1. In the left column of the MyEventGridTriggerFunction overview page, click on Integration.
    2. Click on Event Grid Trigger in the Trigger box.
    3. In the panel that appears on the right of the page, click on Create Event Grid Subscription.
    4. On the Basic information page that appears for the Event Subscription, modify the following fields and click on Create:
    • Name: blobevent
    • Topic Types: Storage Accounts (Blob & GPv2)
    • Subscription: Select the only option available
    • Resource Group: Select the only option available
    • Resource: Select the only option available
    • System Topic Name: BlobEvents
  4. Challenge

    Create a Container in the Storage Account and Set Up Cloud Shell

    1. At the top of the azure portal, click on Home.
    2. Under the Navigate section, select All Resources.
    3. Click on the storage account resource, which will begin with stg.
    4. In the left panel under Data Storage, click Containers.
    5. Click + Container.
    6. Enter images for the Name of the container in the panel that pops up.
    7. Click Create.
    8. At the top of the Azure Portal right next to the search bar, click on the Azure Cloud Shell icon.
    9. A panel will pop up at the bottom of the page. Adjust the size of the panel as needed and select bash.
    10. Next to the Subscription box, click on Show advanced settings.
    11. For the Cloud Shell region field, select West US.
    12. For the Resource Group field, leave Use existing selected.
    13. For the Storage account field, select Use existing.
    14. For the File share field, leave Create new selected and enter cshell for the name of the file share.
    15. Click Create storage and a panel will open up at the bottom of the azure portal page. Adjust the shell as needed.
  5. Challenge

    Upload a File to the Images Container and Examine the Function Logs to Verify It Ran

    In Cloud Shell, type in and run the following command replacing your_app_name and your_resource_group fields with your unique app name and resource group values:

    az webapp log tail --name *your_app_name* --resource-group *your_resource_group*

    Note: If you hit tab after the name and resource group fields, it will populate with the only available option.

    1. Click on the images container.

    2. Click Upload.

    3. In the panel that pops up, click the folder button to open the file browser.

    4. Select a local file and then click Open. It is recommended to use a small text file or image.

    5. Click Upload.

    6. In the shell, you should notice an API call is logged for the upload blob event just triggered.

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