Insights Create an Azure Function with Python to Retrieve GPS Coordinates from an Image EXIF in Azure Storage

Create an Azure Function with Python to Retrieve GPS Coordinates from an Image EXIF in Azure Storage

This post is part of a series. If you want to work on creating your own Wildlife ID environment, start here!

We started with provisioning an Azure storage environment that this uses to retrieve images. In this post we’ll provision the Azure Function, deploy the code via VS Code and configure an App Insights availability tracker.

Let’s start by creating a function:

Fill in the function details and use our already created resource group. Ensure you create this as Python so it has the correct runtime stack.

Open Visual Studio Code and create a new project, then taking the code below and inserting into the editor:

This should then look like this:

Sign in to your Azure Account, then select the up arrow to deploy, selecting your Azure Function as the deployment target:

Then deploy. Yes, we want this to move also into a DevOps environment and we’ll do that ASAP.

You should then get a successful deployment:

Now that you have an Azure Function, let’s test it. Start by uploading a file with EXIF data into your storage account we created earlier.

Then, get the link to the image and validate you can access it:

So, then copy the default key

So, then combine your URL with the following:

Ok… one last thing, now let’s make sure we have an availability test configured for the Azure Function. Select the Application Insights instance:

Then select Availability:

Select “Add Test” to create the availability test:

Put in the successful test we did above into your availability test, set to run every 5 minutes. Click “create”.

Now you’re cooking with gas! You now have an Azure Function that provides GPS data based on an image.

Nathan Lasnoski