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 Previous Command History in PowerShell Console

January 31, 2023

How to Install the PowerShell Active Directory Module...

January 31, 2023

Finding Duplicate E-mail (SMTP) Addresses in Exchange

January 27, 2023

How to Disable or Uninstall Internet Explorer (IE)...

January 26, 2023

How to Delete Old User Profiles in Windows?

January 25, 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

  • Configure User’s Folder Redirection with Group Policy

    February 3, 2023
  • Using Previous Command History in PowerShell Console

    January 31, 2023
  • How to Install the PowerShell Active Directory Module and Manage AD?

    January 31, 2023
  • Finding Duplicate E-mail (SMTP) Addresses in Exchange

    January 27, 2023
  • How to Delete Old User Profiles in Windows?

    January 25, 2023
  • How to Install Free VMware Hypervisor (ESXi)?

    January 24, 2023
  • How to Enable TLS 1.2 on Windows?

    January 18, 2023
  • Allow or Prevent Non-Admin Users from Reboot/Shutdown Windows

    January 17, 2023
  • Fix: Can’t Extend Volume in Windows

    January 12, 2023
  • Wi-Fi (Internet) Disconnects After Sleep or Hibernation on Windows 10/11

    January 11, 2023

Follow us

woshub.com
  • 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)?
  • Enabling Modern or Basic Authentication for Microsoft 365
  • IdFix: Preparing On-Prem Active Directory Sync with Azure
  • Configuring UserPrincipalName and UPN Suffixes in Active Directory
  • Using Microsoft Graph API to Access Azure via PowerShell
Footer Logo

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


Back To Top