No inconvenience at all, I'm here to help!
For "lastPasswordChangeDateTime" and "createdDateTime", these properties are not directly available from the Get-AzureADUser cmdlet. However, they are available through the Microsoft Graph API.
The lastPasswordChangeDateTime attribute is part of the passwordProfile object which is not directly exposed via the Get-AzureADUser cmdlet. You can get this data through the Graph API by querying the /users endpoint.
The createdDateTime attribute is also not directly available via Get-AzureADUser. This data can also be accessed using Microsoft Graph API.
In order to access these data, you will need to have the necessary permissions granted to your application in Azure AD, and you will have to use an OAuth token when making requests to the Microsoft Graph API.
Here's an example of how you could get these properties for a user via the Graph API:
$userId = 'userId' # replace this with the user id you want to get info for
$token = 'token' # replace this with your OAuth token
$headers = @{
'Authorization' = "Bearer $token"
}
# Get the user
$response = Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/users/$userId" -Headers $headers -Method Get
# Output the attributes
$response.createdDateTime
$response.passwordProfile.lastPasswordChangeDateTime
Please be aware that you will need to replace 'userId' and 'token' with the actual User ID and OAuth token.
Keep in mind that managing and maintaining OAuth tokens can be tricky, so be sure to securely manage these credentials.
To your success
Peter