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

November 30, 2021 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 "f.martusciello@woshub.onmicrosoft.com"| 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.martusciello@woshub.onmicrosoft.com").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
1
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

Configuring Event Viewer Log Size on Windows

May 24, 2023

How to Detect Who Changed the File/Folder NTFS...

May 24, 2023

How to Create, Change, and Remove Local Users...

May 17, 2023

View Success and Failed Local Logon Attempts on...

May 2, 2023

Fix: “Something Went Wrong” Error When Installing Teams

May 2, 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

  • Configuring Event Viewer Log Size on Windows

    May 24, 2023
  • How to Detect Who Changed the File/Folder NTFS Permissions on Windows?

    May 24, 2023
  • Enable Single Sign-On (SSO) Authentication on RDS Windows Server

    May 23, 2023
  • Allow Non-admin Users RDP Access to Windows Server

    May 22, 2023
  • How to Create, Change, and Remove Local Users or Groups with PowerShell?

    May 17, 2023
  • Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows

    May 16, 2023
  • View Success and Failed Local Logon Attempts on Windows

    May 2, 2023
  • Fix: “Something Went Wrong” Error When Installing Teams

    May 2, 2023
  • Querying Windows Event Logs with PowerShell

    May 2, 2023
  • Configure Windows LAPS (Local Administrator Passwords Solution) in AD

    April 25, 2023

Follow us

  • Facebook
  • Twitter
  • RSS
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
  • Manage Groups in Azure AD and Microsoft 365 Using PowerShell
  • How to Hide Users and Groups from the Global Address List on Exchange/Office 365?
Footer Logo

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


Back To Top