Hi @Reni Calonge
You appear to be using the daemon-specific client credentials flow, which only supports application permissions because it is an unattended authentication flow.
Therefore, try granting User.Read.All
or Directory.Read.All
application permissions to your app to get a list of users in the tenant.
Hope this helps.
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.