Hi @Stapf, Peter ,
As it's stated in the API error message, creation of temporaryAccessPassAuthenticationMethod for self-user account is currently not supported or allowed. As you can see in the below screenshot from Azure portal, the same is the case even from Azure portal UI and "Add authentication method" option is disabled for the self-user account. Hence this restriction of not allowing temporaryAccessPassAuthenticationMethod for self-user account is applicable either using Azure portal UI or Graph API.
Create temporaryAccessPassAuthenticationMethod Graph API with UserAuthenticationMethod.ReadWrite.All Delegated permissions is working fine for the other users in the tenant, as you can see in the below example screenshot. As mentioned in this documentation, for delegated scenarios where an admin is acting on another user, the admin needs one of the following Azure AD roles:
- Global administrator
- Privileged authentication administrator
- Authentication administrator
Example :
POST https://graph.microsoft.com/beta/users/******@o365XXXX.onmicrosoft.com/authentication/temporaryAccessPassMethods
Note : Temporary Access Pass Authentication Method Graph API is currently available only in Beta. APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.
Hope this helps.
If the answer is helpful to you, please click "Accept Answer" and kindly upvote it. If you have additional questions about this answer, please click "Comment".