This GitHub repository contains a number of scripts, as DOS batch files, that do simplify the setting up of an Azure Sphere device. Where user input is required a user prompt for input occurs. Where the user needs to make a choice from existing Azure or other resources, a numbered list is auto-generated, with selection being made by choosing the item number.

“Azure Sphere is a secured, high-level application platform with built-in communication and security features for internet-connected devices. It comprises an Azure Sphere microcontroller unit (MCU), tools and an SDK for developing applications, and the Azure Sphere Security Service, through which applications can securely connect to the cloud and web.”

azuresphere

Context

So you have an Azure Sphere and you want to get cracking with it ASAP! You can do so by following the documentation on docs.microsoft.com. There’s quite a bit to get through and much of it is of the format: Do this then do that then … . But it does seem a bit mechanical in that if, having done it once and had to do it again in a new environment, the actions would be largely the same. So couldn’t some or a significant amount of it be automated, or at least scripted?

This GitHub repository contains a number of scripts, as DOS batch files, that do simplify this procedure. Where user input is required a user prompt for input occurs. Where the user needs to make a choice from existing Azure or other resources, a numbered list is auto-generated, with selection being made by choosing the item number.

The Scripts

There are currently three main scripts:

Setup.bat Guides you through setting up Azure CLI, AzureSphere command prompt and Active Directory.

ClaimDevice.bat One for setting up the Active Directory Tenant for, and including the device,

AzsHub.bat One for setting up the Azure IoT Hub Device Provisioning Service and connecting the device to it

Nb: NOTE THAT TENANTING OF AN AZURE SPHERE DEVICE IS ONCE ONLY ACTION, NOT UNDO-ABLE, NOT CHANGEABLE, NOT REVERSABLE. SO TAKE CARE WITH THAT SCRIPT. ALL CARE BUT NO RESPONSIBILITY AT THIS END.

There are a number of other scripts that are called by these two scripts, each with a specific function. In the main, parameters are passed to these from the main scripts as environment variables. All subscript results are passed back as environment variables that are then used by the main scripts as parameters to Azure calls.

Each step in the two main scripts has a prompt so that you can skip the action if already done. That way if you are part way through a script you can restart it and skip to where you are up to. Also you can do a “dummy run that way.

Currently the scripts do not address setting up the required Active Directory, but you are referred to the appropriate web page. I used my AD from my Office 365 subscription (ominmicrosft.com) for which I use my domain name (sportronics.com.au)

Whilst these scripts are DOS Batch files, it is envisaged that a subsequent version with use Powershell.

The scripts require the azure CLI (Command Line Interface) to be installed as well as AzSphere. These are referred to in setup.bat

Note: These scripts were developed with the Private Preview Version of the software using TP 4.2.1 We are currently up to 19.03 for Azure Sphere Public Preview. There has also been versions 18.11 19.02 (I guess the version numbers mean Year.Month). These scripts haven’t been tested on those later versions of the software.


 TopicSubtopic
  Next: >  
<  Prev:   Jekyll
This Category:Az IoT Hub + Edge
  Next: >  
<  Prev: