Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • 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 2012
    • 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

Using PowerShell Behind a Proxy Server

July 1, 2022

Checking Windows Activation Status on Active Directory Computers

June 27, 2022

Configuring Multiple VLAN Interfaces on Windows

June 24, 2022

How to Disable or Enable USB Drives in...

June 24, 2022

FAQ: Licensing Microsoft Exchange Server 2019/2016

June 14, 2022

Leave a Comment Cancel Reply

Categories

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

Recent Posts

  • Using PowerShell Behind a Proxy Server

    July 1, 2022
  • How to Access VMFS Datastore from Linux, Windows, or ESXi?

    July 1, 2022
  • How to Deploy Windows 10 (11) with PXE Network Boot?

    June 27, 2022
  • Checking Windows Activation Status on Active Directory Computers

    June 27, 2022
  • Configuring Multiple VLAN Interfaces on Windows

    June 24, 2022
  • How to Disable or Enable USB Drives in Windows using Group Policy?

    June 24, 2022
  • Adding Domain Users to the Local Administrators Group in Windows

    June 23, 2022
  • Viewing a Remote User’s Desktop Session with Shadow Mode in Windows

    June 23, 2022
  • How to Create a Wi-Fi Hotspot on your Windows PC?

    June 23, 2022
  • Configuring SSH Public Key Authentication on Windows

    June 15, 2022

Follow us

woshub.com

ad

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Whitelist Domains and Email Addresses on Exchange Server and Microsoft 365
  • Checking User Sign-in Logs in Azure AD (Microsoft 365)
  • Enabling Modern or Basic Authentication for Microsoft 365
  • How to Reset User Password in Azure Active Directory (Microsoft 365)?
  • How to Connect to Azure AD Using PowerShell?
  • Assigning User Licenses in Microsoft 365 (Azure AD) with PowerShell
  • Regional Mailbox Settings (Language, TimeZone) in Outlook, Exchange, and Microsoft 365
Footer Logo

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


Back To Top