Run an Raspberry Pi Simulator and connect to an Azure IoT Hub Part 1 – Create an Azure IoT Hub

Now we’ll jump into Azure Portal and create ourselves an Azure IoT Hub that later will manage our Raspberry IoT Device. You can read more here.

In Azure search and create an IoT hub. Remember that the IoT Hub name is public so create something unique and also you should select a IP filter.

There we go! Now we got our IoT Hub.

In the next post we’ll create our Client in Azure.

Create an Azure Function using Visual Studio Code Part 6 – Swap deployment slots

Okey, now with our new update added to another slot let’s finally swap this to our production.

In Azure, select your function app and deployment slots, press Swap and verify the source to destination.

Done and done! Now head over to your root function app url and verify that your deployed Azure function have swapped places.

Create an Azure Function using Visual Studio Code Part 5 – Using deployment slots

So now with the Azure Function in Azure we better update our code so it doesn’t say in our local environment.

Create a deployment slot in the Azure portal and give it a name.

Now head over to Visual Studio Code and inside the local project folder change the .cs code to read IN AZURE and save the file.

Right click and deploy to the new slot!

Jump back into Azure and select the deployment slot and fetch the url and append the text and Voila!

You’ve just pushed an new Azure Function app into a dev slot! Remove the -slot1 and you’ll see your old values.

In the final blog post we’ll swap this slot1 to the production slot.

Create an Azure Function using Visual Studio Code Part 4 – Deploy function to Azure

Now let’s upload this function to Azure to use online!

Go into the Azure extension and press on sign in to Azure.

After you have logged in press on the Deploy to function app.

Select create a new function app in Azure, create a global unique name and select a region.

Once done check if it’s complete by pressing the bell button.

Next jump into Azure and get the function URL and check out your function app in Azure!

But wait a minute, now our code is wrong! It’s in Azure right? Let’s push an update in the next blog post!

Create an Azure Function using Visual Studio Code Part 3 – Edit the code and pass a query string

Last time we had our Azure Function with C# and deployed and tested it. Let’s go into the function code and make a change and pass a query string and watch our function reply.

Go into the project folder and change the text after hello to say

"on my local environment!"

Launch the debugging again and append below to your string.

?name=DonaldDuck

There you go! Now in the next post we will deploy to Azure!