Skip to main content

Notifications

Power Automate - Building Flows
Unanswered

Get user profile fails with odd NotFound error even though input is valid UPN

Posted on by 8
Hello, we have a flow where the Get User Profile suddenly stopped working for some users.
To investigate the issue I created a small flow that shows the minimum needed for the issue. Here I have an action that searches for a UPN and then uses the returned user to try and get using the "Get User Profile (V2)".
I have tried with different users and it seems to work for some, and not for others.
Here is what happens:
  1. I trigger the flow manually
  2. A search is performed with the provided UPN, 1 matching user is found
  3. Get user profile (V2) is called with the "UserPrincipalName" from the "Search for users (V2)" but fails to find any users and returns "NotFound"
 
Expected behavior: If I try to use the action "Get user profile" with a UPN that I just read from the action "Search for users" I expect the other action to find the same user.
 
Added context that might be interesting:
If I try to hardcode a UPN that doesn't exist in the Get user profile, I get a different error from when I enter the known UPN from the search for user step. And with some UPNs, it works with the Get user profile.
 
This is the output I get with the malfunctioning user:
{
"error": {
"code": "-1, Microsoft.SharePoint.Client.ResourceNotFoundException",
"message": "Exception of type 'Microsoft.SharePoint.Client.ResourceNotFoundException' was thrown.",
"innerError": {
"date": "2024-11-23T18:06:39",
"request-id": "8e34f65a-939d-43de-986f-ce8c5b61a162",
"client-request-id": "8e34f65a-939d-43de-986f-ce8c5b61a162"
}
}
}
 
And this is the error I get when entering a known-nonexistent UPN:
{
"error": {
"code": "ResourceNotFound",
"message": "User not found",
"innerError": {
"date": "2024-11-23T18:12:20",
"request-id": "e821a1b7-d447-44b7-bb26-65f7f775c9b4",
"client-request-id": "e821a1b7-d447-44b7-bb26-65f7f775c9b4"
}
}
}
 
Hoping that I might be able to get some support from this community with what it is that I'm doing wrong. Thanks in advance 😊
  • Fabian-Pride Profile Picture
    Fabian-Pride 8 on at
    Get user profile fails with odd NotFound error even though input is valid UPN
    Sorry for taking some time to respond here.
    I agree with @AK-05120946-0 that the linked thread seems similar to what I'm experiencing.
     
    To answer your question @Expiscornovus:
    When re-running the flow today I'm still getting the same error, and when looking at the output from "Search for users (V2)". Both the output field "UserPrincipalName" and "Mail" have identical values (I verified that they are identical by running the powershell command '[mail] -ceq [UPN]' and getting back "True").
     
    I'm going to try and redo our most important automate flows using "Get user profile", but I would love to get a solution to this and are happily accepting suggestions 😊
  • AK-05120946-0 Profile Picture
    AK-05120946-0 3 on at
    Get user profile fails with odd NotFound error even though input is valid UPN
    Hi,

    My organisation is also having this issue - "Get User Profile" does not pull the user ID and errors out, but "Search for Users" works fine. The accounts we are having errors with are in the correct groups, with the correct licences, and have no other issues.

    Seems like this is an issue on Microsoft's end as I found a similar thread from 2019:
     
    https://community.powerplatform.com/forums/thread/details/?threadid=e57d0276-a8e4-4b71-83e5-425bb6ea3bbd

    Microsoft claims to have rolled out a fix for this.

    Our issues started around the same time as this post was made, so it can't be a coincidence.

    Can someone from Microsoft look into this please? It is not feasible for us to change every flow to use the "Search for Users" connector.

    Thanks

    Adam
  • Expiscornovus Profile Picture
    Expiscornovus 30,706 on at
    Get user profile fails with odd NotFound error even though input is valid UPN
     
    Thanks for sharing your tests. 
     
    Can you inspect the search for users actions outputs. What do you see in the mail property and UserPrincipalName property of the 'magical' user? Are those values different?
     
    In my example the values of those two properties were different for my external user test case. That's why I thought this was related to the fact it was an external user, that might not be the case on second thought 😅
  • Fabian-Pride Profile Picture
    Fabian-Pride 8 on at
    Get user profile fails with odd NotFound error even though input is valid UPN
    Hello @Expiscornovus, and thanks for your reply!
    That's such a great suggestion. Unfortunately the account I'm trying to find isn't an external account. The account was created by another power automate flow, and it's a flow I've been using for almost a year now with great success until now.
     
    Your reply did get me very curious. Inspired by your reply I tried re-running my flow and searched for a known external user (guest user).
    To my surprise, it worked :O
    Maybe guest and external users are different, I don't know.
     
     
    But I know that this seemed to have worked, while my "magical" user still isn't working :/
     
    When you got your "not found" error while searching for an external user, did you get the response with: "code": "ResourceNotFound" (as I got when searching for a known not-existing user) or the response "code": "-1, Microsoft.SharePoint.Client.ResourceNotFoundException", similar to what I'm getting with my newer user.
     
    Some context regarding my "new user". It was created on the evening on the 23rd (more than 48 hours ago). It was created using the Power Automate action "Create User". The call to "Create User" worked without an issue. This same Power Automate flow that creates users are usually executed about twice each week, and this is the first user we've had issues with.
     
    I really appreciated your previous reply and hope that you (or anyone else) might have any more ideas. Thanks in advance!
  • Expiscornovus Profile Picture
    Expiscornovus 30,706 on at
    Get user profile fails with odd NotFound error even though input is valid UPN
    A user can exist without a profile. Are these by any change external users?
     
    The Search for users searches for your keywords in the display name, given name, surname, mail, mail nickname and user principal name fields.
     
    So, it is possible it found a match in one of the other fields as well. In case of an external user it would find a match based on the mail field, but no profile would be found in the Get user Profile (v2) because it is an external user.
     
    Below is an example which demonstrates this
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,591

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,090

Leaderboard