Export Users with no birthday set in profile using Microsoft 365 CLI

How to get the Users with no Birthday information in a Profile using Microsoft 365 CLI

I came through a requirement to set birthday information for all users who don’t have that value in the User Profile. Before doing that, I need a list of users with no birthday value set in the user profile.

Microsoft 365 CLI tool is coming in handy to retrieve that information. But the REST API or Microsoft GRAPH API used by the command, that doesn’t provide the birthday Information in a User collection. To get BirthDay, we must send the request to the server along with the user to fetch that. I have used below two commands in my script,

Get all Lists from AAD

m365 aad user list

Get BirthDay information for the provided user

m365 aad user get –properties birthDay –userName <User Name>

Below is the Sample script I used, the same for your reference,

Hope, this report helps in the large user base and we can use the same kind of script for other users properties.

Shantha Kumar
Shantha Kumar
Articles: 295

24,849 Comments

  1. Hi shantha,
    Where are you setting the new birthday values for those null entries in the code. Can you pls elaborate?

    Thanks

Comments are closed.