# Creating the Azure Logic App for our IoT Button

# The Series so Far

At Build 2018, we first saw the IoT Button (opens new window). I started exploring the device (opens new window) with the very first unboxing and decided to create a mini-series to walk you how to use the device from start to finish. The series (so far) is located below

# Creating the Azure Logic App for our IoT Button

Now that we know how to setup an IoT Hub and configure out device to get on the network and use said IoT Hub, now we need to actually get to what we are going to build:

An app that automatically add a row to an excel sheet that includes a time along with a status (such as start or stop).

Add an Azure Logic App and provide the details for Name, Description, Resource Group and more and click Add.

Click on When a HTTP request is received, to use as our template

Since we're going to pass a field into this Logic App that writes if the status is Started or Stop in the excel sheet. This means that we need to add a field into the Request Body JSON Schema as shown below:

{
    "properties": {
        "status": {
            "type": "string"
        }
    },
    "type": "object"
}
1
2
3
4
5
6
7
8

We'll also want to make sure that this is a POST method.

Before we proceed to add an action, we need to open a tab and login to OneDrive to create an Excel book and a table we can use in the next connector. I created one in the following location in my OneDrive /Excel/Book1.xlsx. Go ahead and create some data as shown below, with at least a StartTime and a Text in your OneDrive account.

You'll also need to create a table inside of it. Just open the Excel file add some data and then click the Table button.

Now we'll add an action and use the Add a row into a table (OneDrive) connector.

And we'll provide our File, Table as indicated above.

For the StartTime, we'll want to use an Expression with the code utcNow('M/d/yyyy h:mm'). This will give us a nicely formatted Date that we can easily work with.

For the Text, just use the Dynamic content called status that we are passing in.