Forum Discussion
Dynamic group membership
Hello community!
I want to create new dynamic group which contains users that created less then 3 months. I don’t see option “created date time” when I configure the rules of dynamic group.
Could you help me?
Thank you!
- KurtBMayerSteel Contributor
Alas, this doesn't appear to be an available option for the group query syntax. This article lists out all the available attributes: Dynamic membership rules for groups in Azure Active Directory
Please like or mark this thread as answered if it's helpful, thanks!
- ultrapepCopper Contributor
Hi,
Thanks for your answer!
Is it possible to configure it via logic app or function app?
Maybe some other ways?
Thank you!
- LainRobertsonSilver Contributor
Given that you can indeed filter on createdDateTime in a Graph call, you should have no issues doing so using the Logic App/Function approach you've suggested.
I'm not Logic-anything aficionado meaning I can't guide you through doing that, but here's a basic demonstration of a Graph call in action using Microsoft's Microsoft.Graph.Authentication PowerShell module.
Note that Graph is particularly fussy on the format of [datetime] values. It needs to be in ISO 8601 format while also adding a trailing "Z", as you can see from the example. If it's not in this format you'll get a HTTP 401 response from Graph.
No doubt you're also aware of this but you need to work with UTC time, too.
(Invoke-MgGraphRequest -Method GET -Uri 'https://graph.microsoft.com/beta/users?$filter=createdDateTime ge 2022-08-30T00:00:00Z').value | ForEach-Object { [PSCustomObject]$_ } | ft -AutoSize id, userType, userPrincipalName;
Cheers,
Lain