Speeding up installation of AIO (Azure IoT Operations) deployment using a script

danuw

Dan Benitah

Posted on June 1, 2024

Speeding up installation of AIO (Azure IoT Operations) deployment using a script

If you're eager to learn more about AIO (Azure IoT Operations), which is currently in private preview, it's crucial to start with a fresh install to experiment quickly and efficiently. In this post, I will guide you through the steps to reinstall your cluster using a script, ensuring a smooth learning experience. Let's get started!

For now, the assumption is that you are using fresh codespace using those steps. Updated script for physical machines with Ubuntu server coming soon...

Setup the cluster again and deploy the AIO extension

Note: if your are looking at a new version of AIO, the script may need adapting - this has been tested with AIO v0.5-preview at the time of writing

1. Set up your variables

1.a RESOURCE_GROUP

When you created your Codespace, you had to provide some variable values such as the resource group, so double check that the resource group variable is what you expect with echo $RESOURCE_GROUP, and otherwise set it using (update value as needed):

export RESOURCE_GROUP=aio-codespace-rg
Enter fullscreen mode Exit fullscreen mode

1.b IOT OPS USER_EMAIL

To ensure your user can access the AIO UI, specify your IoT Ops user email with the following command, replacing with your actual email address:

export USER_EMAIL=<your-email>
Enter fullscreen mode Exit fullscreen mode

Note: Remember that user needs to be a member of the tenant such as iotops@YOUTENANT.onmicrosoft.com
If you do not have one, use export USER_EMAIL=$(az ad user create --display-name 'IoT Ops User' --password <PASSOWRD> --user-principal-name iotop@<TENANTNAME>.onmicrosoft.com --force-change-password-next-sign-in false -o tsv --query userPrincipalName)

1.c Other Variables (optional)

Consider double checking other environment variables such as the $CLUSTER_NAME to suit your preferences.

2. Login

Ensure you are signed into your Azure Account by running the following command in your terminal, then follow the instructions in your browser:

az login --use-device-code
Enter fullscreen mode Exit fullscreen mode

3. Run your setup script

Create a file named setup.sh in your Codespace and copy the content from this gist into it.

Once you have updated your variables and logged into Azure, you are ready to run the script with the following command:

. ./setup.sh
Enter fullscreen mode Exit fullscreen mode

Running the command in Codespace

Note: Currently tested on Codespace, but will soon update with script for Ubuntu server including Az CLI install and other pre-requisites for re-install

4. Manual Validation

Based on experience, if your Codespace setup remains unchanged (same number of cores, etc.), you can expect this whole process to take approximately 25 minutes.

After the process completes, navigate to IoT Operations Portal and sign in with your member user account. You should see your cluster listed as connected.

IoT Operations Portal with your connected cluster

Next?

Thank you for reading this far. I hope this script helps you experiment faster with AIO. In the future, I plan to:

  • Expand the script with new steps: As AIO evolves and more APIs become available, additional processes can be automated. You may also consider improving the script as you explore or revisit the latest features, in which case don't forget to let me know in the gist's comments.
  • Cover more scenarios, such as creating assets using CLI.

References:

💖 💪 🙅 🚩
danuw
Dan Benitah

Posted on June 1, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related