This is Part 7 of a 8 part series in getting Azure IoT Edge setup with the Raspberry Pi.
You can read the other parts here…
Part 1 – Setting up Raspbian Buster
Part 2 – Creating an IoT Hub and Edge Device
Part 3 – Creating an Azure DevOps Organisation, Project, Settings, etc
Part 4 – Setting up the Azure IoT Edge Device Pi
Part 5 – Setting up the Azure IoT Edge Build Pi
Part 6 – Creating an Azure Container Registry
In this post we’ll download the Source Code form the Azure DevOps project we created in Part 3.
The Source code is stored in a Git Repository within our project, which we can clone onto our machine and open in Visual Studio Code.
What we’ll be doing
1 – Return to the Azure DevOps Project
2 – Navigate to the Project Repo
3 – Clone the Repo to VS Code
4 – Add a README and a gitignore
What we’ll be doing
In the previous post, we created an Azure Container registry to house our IoT Edge Modules.
In this post, we’ll download the Source Code for our IoT Edge Project from the Azure DevOps project we created in Part 3.
Azure DevOps stores our Source Code in a Git Repository within our project. We can clone this repository onto our local machine and open it in an editor such as Visual Studio Code.
We can then add a README and a Git Ignore File, and pull these changes into our local repo too.
1: Return to the Azure DevOps Project
We need to go and clone our Code to our local machine. We can do that directly from the Azure DevOps Project we created in Part 3 earlier.
Head back to dev.azure.com and sign in if required.
On the left hand side, click on the organisation you created earlier, for my this was “pjgiotedgedevops“.
Next click on the project we created, for me this is the “iotedge” project.
2: Navigate to the Project Repo
Next, hovering over the “Repos” menu item on the left, click the “Files” menu item to browse to our Repo.
3: Clone the Repo into VS Code
We can now clone our Project Repo to our local machine and open it in VS Code by hitting the “Clone in VS Code” button;
This will open a new window and a prompt asking if VS Code can be opened, hit the “Open Visual Studio Code” button;
Visual Studio Code will then open and Prompt “Allow an Extension to open this URI“, click the “Open” button;
Next up we’ll need to choose a location on our machine for where the cloned code should reside. VS Code will open a “Select Folder” dialog. Go ahead and choose a location on your machine that makes sense to you.
You’ll see the progress of the cloning appear as a notification in the bottom right hand corner of the screen;
You’ll now be asked to sign in to your DevOps organisation, so go ahead and do that;
Once the cloning has completed, you’ll then be prompted to open the repository in VS Code;
VS Code will then open your Repo.
4: Add a README and a gitignore File
We can now add a couple of files to our Repo and check if we’re linked up correctly.
Return to your DevOps project and the Repo Files;
Towards the bottom of the screen, in the “Initialize the README or gitignore” section, make sure the “Add a README” checkbox is selected. Drop down the “Add a .gitignore None” dropdown box and select “Node“.
Now press the “Initialize” button to add these two files to our project.
5: Sync Repo Changes to VS Code
We can now return to VS Code and synchronise the changes we’ve made to the repo down to our local machine.
Back in VS code, click the Source Control toolbox item on the left hand side of the screen;
Hitting the ellipsis (3 horizontal dots) icon in the Source Control Window will drop down the Source Control Menu.
Bit the “Pull” menu item to pull in the latest changes to your local machine;
To be continued…
In this post we synced the Azure DevOps project to our local machine. We also added a README and .gitignore file to our Project and checked that we could pull in those changes within VS Code.
In the next post we’ll use the Azure IoT Toolkit VS Code Plugin to connect VS Code up to our Azure IoT Hub so we can manage and monitor our IoT Hub Devices.
Scaffold the IoT Edge Code >