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

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
- 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/
- The following permissions added to your SAM application and granted admin consent:
Permission | Type |
---|---|
Application.Read.All | Application + Delegated |
AuditLog.Read.All | Delegated |
DeviceManagementApps.Read.All | Application + Delegated |
DeviceManagementConfiguration.Read.All | Application + Delegated |
DeviceManagementManagedDevices.Read.All | Application + Delegated |
Directory.Read.All | Application |
Group.Read.All | Application + Delegated |
Organization.Read.All | Application + Delegated |
Policy.Read.All | Application + Delegated |
Reports.Read.All | Application + Delegated |
SecurityEvents.Read.All | Application + Delegated |
- Hudu API Keys.
- 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)
- The names of the Hudu asset types for People, Devices and Mobile devices in Hudu.
- A field called ‘Microsoft 365’ of type ‘RichText’ added to each of the above asset layouts
- An overview company created and the name of it in Hudu if you wish to use that feature.
- 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 Name | Description |
---|---|
PeopleLayoutName | The name of the Asset Layout in Hudu used to track People / Users. (Must exist already with a richtext Microsoft 365 field) |
DesktopsName | The name of the Asset Layout in Hudu used to track Desktops / Laptops. (Must exist already with a richtext Microsoft 365 field) |
MobilesName | The name of the Asset Layout in Hudu used to track Mobile Devices. (Must exist already with a richtext Microsoft 365 field) |
customerExclude | A list of customer M365 display names to skip from the sync. |
ApplicationId | The application ID of your M365 SAM application. |
ApplicationSecret | The application secret for your M365 SAM application. |
TenantID | Your Partner Tenant ID. |
RefreshToken | The long refresh token for your M365 SAM application. |
ExchangeRefreshToken | The long Exchange refresh token for your SAM application. |
HuduAPIKey | Your Hudu API Key. |
HuduBaseDomain | Your Hudu Base Domain. |
WebhookURL | An incoming Teams Webhook URL to recieve Sync Errors and Reports |
PSAUserURL | The URL used to link a user in Hudu to your PSA (Only Halo supported at present) |
RMMDeviceURL | The URL used to link a device to your RMM (Only Datto RMM support at present) |
RMMRemoteURL | The URL used to launch a remote session on a device in your RMM (Only Datto RMM support at present) |
CreateInOverview | Set to true to create all Magic Dashes in an overview company as well. |
OverviewCompany | The name of the overview company to use for Magic Dashes (Must exist already). |
DocumentPartnerTenant | Set to true to also document your partner tenant to Hudu. |
PartnerDefaultDomain | Your Partner Tenant’s default domain name. |
PartnerDisplayName | Your Partner Tenant’s display name. |
Script Settings
Setting Name | Description |
---|---|
CreateUsers | Set to true if you wish to create People / Users in Hudu from M365 if they do not exist. |
CreateDevices | Set to true if you wish to create Desktops / Laptops in Hudu from M365 if they do not exist. |
CreateMobileDevices | Set to true if you wish to create Mobile Devices in Hudu from M365 if they do not exist. |
importDomains | Set to true to import domains in M365 to Hudu Websites. |
monitorDomains | Set to enable monitoring on imported domains. |
IntuneDesktopDeviceTypes | Endpoint Manager / Intune device types to identify desktops. All others will be treated as mobile devices |
ExcludeSerials | Serial 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