I'm a little confused why you're creating an app in Azure just to query the API. In general you don't need to do this. All you would need to do is make an OAuth request using a user that already has permissions. But I don't that this is the actual problem you're having.
When you are connecting via OAuth you have to specify the scope(s) you want to request. You are missing that part of the request when getting the token. It should look something like this:
--form 'scope=Files.Read.All'
The above, when used when you request your bearer token, will request that the returned token have the given scope. When the token is subsequently passed to the API endpoint the endpoint will confirm that the token was granted the required scope before allowing the request.