@Denis Pasternak Thanks for posting in our Q&A.
For this issue, if you want to get device primary user via Graph, it still needs to have an Azure AD account to sign in Microsoft graph explorer. And then run the request.
We can use the following request to get the Primary User.
If you want to get device primary user via PowerShell script, please refer to the following link.
Hope it will give you some ideas.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.