Hi Aidan,
you can use the graph REST API to retrieve that data.
https://graph.microsoft.com/v1.0/users
Permissions needed would be Directory.Read.All
A good place to test the out the REST APIs is the graph explorer.
https://developer.microsoft.com/en-us/graph/graph-explorer
Let me know if this what you were looking for or if theres anything further i can help with.