Tool Library Announcement
During a recent conversation someone pointed out that my Github profile is somewhat dusty. Afterwards I took a public view and dang, they’re absolutely right. Nearly all of my recent work has been restricted to private repos or owned by my employers.
Let’s fix that, shall we? Starting today I plan to go through all of the various scripts and applications I’ve written over the years. For each script I’ll tidy them up enough for a public release and publish a blurb about each one.
To kick off the process I’ve released Update-UserAttributes.
Background
Like any good Internet recipe, here’s some context-flavored reminiscing.
It was the halcyon days of late 2024 and I had recently taken over as technical owner of our Microsoft 365 environment. One of my primary goals was to cleanup and modernize our technical practices. Previously, all Microsoft 365 administration had been manual. The result was a lot of cruft, inconsistent data, and inefficient processes. One of the first steps of an overall Identity Management Improvement project was to make sure our user data was accurate and trustworthy. This meant defining an authoritative data source for user information and ensuring that the downstream systems, in this case Entra, were kept up to date.
Since Human Resources used Paylocity as their HRIS, this meant setting up the integration for user attribute updates. The integration supports automatic user creation, attribute updates, and account disabling. One hiccup, Paylocity is a purely event driven system. Meaning, it had no way of correcting Entra directory information without individually modifying each and every person in Paylocity.
Thus Update-UserAttributes was born.
The Intent
This script, Update-UserAttributes.ps1, was designed to make bulk modifications to Entra user objects. In my use case, it was to
take an export from Paylocity and perform a reconciliation of directory information (Job Titles, Managers, Departments, etc). In
the general case, I wanted it to be useful as a generic user information management tool. Not every attribute is owned by HR, and this
would give us the opportunity to manage them as needed.
Usage
The best use case is bulk-updating multiple attributes across multiple users simultaneously. To do this, create a CSV file using the
following format. Something important to note is that the header name must match the property name used by the Update-MgUser cmdlet.
|
|
Once you create the CSV you can make the upstream changes by passing it on the command line
.\Update-UserAttributes.ps1 -CSVFilePath .\userlist.csvMore details can be found in the script’s README and Help output.
Caveats
There’s definitely room for improvement. For example:
- Add
-WhatIfsupport - Move Error reporting to
Write-Errorand add gobs more - Actually implement exception handling
- Implement output logging sufficient to be auditable
- Validate CSV input
Please don’t be shy with your feature and/or pull requests. My main reason for publishing is to make it available in the hope that someone else finds it useful.