Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Azure / Get User or Group Creation Date in Azure AD (or MS365) with PowerShell

February 20, 2023 AzureMicrosoft 365PowerShell

Get User or Group Creation Date in Azure AD (or MS365) with PowerShell

In this article, we’ll show how to get a date when a user or group was created in Azure AD or Microsoft 365 using PowerShell.

This assumes you already have the Azure AD Module for PowerShell installed on your computer.

Connect to your Azure tenant:

Connect-AzureAD

Enter your username and password, confirm MFA sign-in (I’m using the Microsoft Authenticator app).

To get information about users in Azure, the Get-AzureADUser cmdlet is used. But there is no createdDateTime attribute among user attributes returned by the cmdlet (unlike Get-ADUser able to return the value of whenCreated attribute from on-prem AD). You can display a list of available Azure AD user attributes as follows:

Get-AzureADUser -ObjectId "[email protected]"| Get-Member

To get information about extended Azure AD object attributes, use the Get-AzureADExtension cmdlet.

For example, to get the creation date of a user by their UserPrincipalName, run the command below:

(Get-AzureADUserExtension -ObjectId "f.m[email protected]").Get_Item("createdDateTime")

PowerShell: Get created date for Azure AD user

You can get the creation time of all users in your Azure AD tenant. Use this PowerShell script to do it:

$Report = @()
$AAD_users = Get-AzureADUser -All:$true
foreach ($AAD_User in $AAD_users) {
$objReport = [PSCustomObject]@{
User     = $AAD_User.UserPrincipalName
CreationDate  = (Get-AzureADUserExtension -ObjectId $AAD_User.ObjectId).Get_Item("createdDateTime")
}
$Report += $objReport
}
$Report

Get creation date of all azure AD (Microsoft 365) users with powershell

You can export the list of Azure AD users to a CSV file:

$Report| Export-CSV "$PSScriptRoot\aad_users.csv"

To get a date when a group in Azure AD was created, you will have to access your tenant using Microsoft Graph API (the connection method is described in the article “Connecting Azure via Microsoft Graph API and PowerShell”). To display group names and the dates when they were created, run the PowerShell script below:

$GrapGroupUrl = 'https://graph.microsoft.com/v1.0/Groups/'
$Groups=(Invoke-RestMethod -Headers @{Authorization = "Bearer $($token)"} -Uri $GrapGroupUrl -Method Get).value
$Groups | select displayName,createdDateTime

Get Azure group creation time via Microsoft Graph API and PowerShell

0 comment
2
Facebook Twitter Google + Pinterest
previous post
Get-ADUser: Find Active Directory User Info with PowerShell
next post
Using Microsoft Graph API to Access Azure via PowerShell

Related Reading

How to Connect VPN Before Windows Logon

November 14, 2023

Removing Azure Arc Setup Feature on Windows Server...

November 9, 2023

Send Emails with Microsoft Graph API and PowerShell

November 6, 2023

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • How to Connect VPN Before Windows Logon

    November 14, 2023
  • Removing Azure Arc Setup Feature on Windows Server 2022

    November 9, 2023
  • Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

    November 7, 2023
  • Send Emails with Microsoft Graph API and PowerShell

    November 6, 2023
  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Checking User Sign-in Logs in Azure AD (Microsoft 365)
  • Whitelist Domains and Email Addresses on Exchange Server and Microsoft 365
  • How to Reset User Password in Azure Active Directory (Microsoft 365)
  • Enable or Disable MFA for Users in Azure/Microsoft 365
  • Enabling Modern or Basic Authentication for Microsoft 365
  • Using Microsoft Graph API to Access Azure via PowerShell
  • Manage Groups in Azure AD and Microsoft 365 Using PowerShell
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top