Using the “Get-AzureADUser” command, I was able to obtain all the above fields except the “CreationDate”. I later discovered that the “CreationDate” property is only available in “Get-AzureADUserExtension” commandlet.
My problem is; I don’t know how to combine these 2 commands (if that’s what is needed) to produce all the fields listed above in a single .csv output file.
I will be extremely grateful if someone would help with a script that would help deliver what is required of me by my employer.
When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
I started learning PowerShell last month, mostly watching tutorials on YouTube. I have come across Graph PowerShell. I looked it up, looks like a query tool. Still confused by it though. Do you have a suggestion on how to go about learning it quickest?
I ran your script. I noticed that the “CreationDate” field is empty for all returned objects.
With regards to Graph PowerShell, I took a look at installing it, but part of that process is the uninstallation of the existing AzureAd module, I plan to do that at a later date.
When posting code in the forum, please can you use the preformatted text </> button. It really helps us with readability, and copying and pasting your code (we don’t have to faff about replacing curly quote marks to get things working). If you can’t see the </> in your toolbar, you will find it under the gear icon.
When specifying properties with Get-MgUser you only get back the properties that you specify so you will need to add Id and any other properties you want to the array. Note that the property names are not always the same as those returned by the Azure AD commands, for example CreatedDate is CreatedDateTime. You can use Get-Member to discover the property names.
The Microsoft Graph API is a REST API that is used to manage Microsoft cloud resources.
Older APIs such as Azure AD Graph, and older PowerShell modules that depend on Azure AD Graph are being deprecated and it’s recommended that scripts that use the older modules (or call the older APIs directly) are migrated to Microsoft Graph.
To use the Microsoft Graph API with PowerShell, it’s recommended to use the Microsoft Graph PowerShell Software Developer Kit (SDK). However, although the SDK continues to improve, it does not yet have feature parity with the older modules, which is one of the reasons Microsoft keep extending the retirement date.
I know that Azure AD Powershell is deprecated, but it works still. I am in a rather desperate situation now. Can you please see if you can get the “CreationDate” to work. Everything in your script is working except that the “CreationDate” field is empty. If you can get this to work, my issues will be resolved.
The problem was that the “createdDateTime” was case sensitive!
I had identical problem with Microsoft Graph and Azure AD powershell and ran Olaf’s code - after I had uninstalled MSGraph (sorry) and installed AzureAD PS module again, but I still had the same problem. Then I noticed “createdDateTime” was written in a funny way.