In this article I want to show you how Data can be exported from Azure AD using PowerShell
At first you have to connect your PowerShell with AzureAD.

To do this use the PowerShell commandlet connect-azuread.
This should spawn a pop-up asking you for authentication.
Use Azure Credentials that have the permissions needed to at least read all properties.

If the connection worked it should look something like this

Getting the data

Here is a good reference for PowerShell commandlets related to AzureAD.

We use get-azureaddevice to get a list of the devices in the Azure Domain.

As you can see the devices do have an ObjectID, a DeviceID and a DisplayName.
These are by far not the only Infos that are available regarding devices.

To get an overview of what values get stored for each device just take one at random (-objectid) and pipe to format list (fl).

In this case I would like to export data on the attributes DisplayName, ObjectId, ObjectType and ApproximateLastLogonTimeStamp.

These can be listed for all devices using the following command.
get-azureaddevice | select DisplayName, ObjectId, ObjectType, ApproximateLastLogonTimeStamp

Exporting the data

For better visibility you can export this info to a CSV file.
To do this pipe STDOUT to export-csv and use a local path to store the file.

In my case the command looks like this:
get-azureaddevice | select DisplayName, ObjectId, ObjectType, ApproximateLastLogonTimeStamp | export-csv C:\temp\foo.csv

Now we can open the file, for example with excel.
Just start excel and select Data > From Text / CSV.

In the import Dialoge select comma separated import and load the file.

Using this import method you can sort columns alphabeticaly.