Hudu Microsoft 365 integration and updated Magic Dash V3

Hudu have recently released an updated editor for assets and articles. I wanted a project to be able to see how far I could push the new editor to improve the display of information in Asset Fields. As well as this I have recently doing a bit of work on the CIPP project (https://github.com/KelvinTegelaar/CIPP). As part of this I have learnt a lot of new approaches to interacting with Microsoft 365. I thought the best approach to combine these things would be to extend and rewrite my Microsoft 365 Magic Dash integration script.

It’s taken quite a long time to put together but I hope you will find the improvements useful. I spent a lot of time working on optimisation of the code and ended up being able to reduce the run time of the standalone script to 35% of the original time it took to run. This was still taking quite a long time which is why I have also re-written it to work as an Azure function app leveraging durable functions. This provides a cheap and easy way to get up and running. Anyway on to what has changed.

New Features

Updated Magic Dash:

User Asset Creation and Documentation:

Device Asset Creation and Documentation:

User and Device Relations:

User CIPP Integration

unknown.png (604×105)

Other Changes:

Rewrite to use all direct graph calls. No dependencies on any MS modules.

New Azure Durable Function version.

Ability to document your own partner tenant

Links to RMM and PSA from iUser and Devices.

Requirements

To run this version of the script you will require several things

  1. A configured M365 Partner SAM Application. To set this up I recommend you follow this guide https://www.gavsto.com/secure-application-model-for-the-layman-and-step-by-step/
  2. The following permissions added to your SAM application and granted admin consent:
PermissionType
Application.Read.AllApplication + Delegated
AuditLog.Read.AllDelegated
DeviceManagementApps.Read.AllApplication + Delegated
DeviceManagementConfiguration.Read.AllApplication + Delegated
DeviceManagementManagedDevices.Read.AllApplication + Delegated
Directory.Read.AllApplication
Group.Read.AllApplication + Delegated
Organization.Read.AllApplication + Delegated
Policy.Read.AllApplication + Delegated
Reports.Read.AllApplication + Delegated
SecurityEvents.Read.AllApplication + Delegated
  1. Hudu API Keys.
  2. M365 to Hudu Tenant mapping completed (Each default domain needs to be setup as a customer under the relevant tenant this script will help with that https://github.com/lwhitelock/HuduAutomation/blob/main/Hudu-M365-Links.ps1)
  3. The names of the Hudu asset types for People, Devices and Mobile devices in Hudu.
  4. A field called ‘Microsoft 365’ of type ‘RichText’ added to each of the above asset layouts
  5. An overview company created and the name of it in Hudu if you wish to use that feature.
  6. Links to your PSA / RMM if using a supported tool (Currently Halo PSA and Datto RMM). (If you would like me to add support to your PSA / RMM please let me know the URL format to open a link to a user / device and the location in the .card data from the Hudu API where the relevant ID that needs to be passed into the URL is stored)

Setttings

There are various settings you can configure for the script. Please see here for their details:

Core Settings

Setting NameDescription
PeopleLayoutNameThe name of the Asset Layout in Hudu used to track People / Users. (Must exist already with a richtext Microsoft 365 field)
DesktopsNameThe name of the Asset Layout in Hudu used to track Desktops / Laptops. (Must exist already with a richtext Microsoft 365 field)
MobilesNameThe name of the Asset Layout in Hudu used to track Mobile Devices. (Must exist already with a richtext Microsoft 365 field)
customerExcludeA list of customer M365 display names to skip from the sync.
ApplicationIdThe application ID of your M365 SAM application.
ApplicationSecretThe application secret for your M365 SAM application.
TenantIDYour Partner Tenant ID.
RefreshTokenThe long refresh token for your M365 SAM application.
ExchangeRefreshTokenThe long Exchange refresh token for your SAM application.
HuduAPIKeyYour Hudu API Key.
HuduBaseDomainYour Hudu Base Domain.
WebhookURLAn incoming Teams Webhook URL to recieve Sync Errors and Reports
PSAUserURLThe URL used to link a user in Hudu to your PSA (Only Halo supported at present)
RMMDeviceURLThe URL used to link a device to your RMM (Only Datto RMM support at present)
RMMRemoteURLThe URL used to launch a remote session on a device in your RMM (Only Datto RMM support at present)
CreateInOverviewSet to true to create all Magic Dashes in an overview company as well.
OverviewCompanyThe name of the overview company to use for Magic Dashes (Must exist already).
DocumentPartnerTenantSet to true to also document your partner tenant to Hudu.
PartnerDefaultDomainYour Partner Tenant’s default domain name.
PartnerDisplayNameYour Partner Tenant’s display name.

Script Settings

Setting NameDescription
CreateUsersSet to true if you wish to create People / Users in Hudu from M365 if they do not exist.
CreateDevicesSet to true if you wish to create Desktops / Laptops in Hudu from M365 if they do not exist.
CreateMobileDevicesSet to true if you wish to create Mobile Devices in Hudu from M365 if they do not exist.
importDomainsSet to true to import domains in M365 to Hudu Websites.
monitorDomainsSet to enable monitoring on imported domains.
IntuneDesktopDeviceTypesEndpoint Manager / Intune device types to identify desktops. All others will be treated as mobile devices
ExcludeSerialsSerial numbers to ignore and attempt to match on device name instead. Add any generic serials that might apply to multiple devices

Azure Function App – Recommended

This is the recommended way to run the script and is what I will most likely be continuing to develop in the future.

Full details on how to deploy and utilize this can be found here: https://github.com/lwhitelock/HuduM365Automation

Standlone Script – Legacy

This scipt is mainly for reference if you want to look through how I have done things. I have added various helper functions to construct the cards inside Asset Fields.

The script can be found here: https://github.com/lwhitelock/HuduM365Automation/blob/master/Standalone/M365-Hudu-Standalone.ps1

You may also like...