Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

get user (AAD) error 404

(0) ShareShare
ReportReport
Posted on by 195

very simple action AAD get user>getting 404 error 

{
  "error": {
    "code": "Request_ResourceNotFound",
    "message": "Resource 'ms@contoso.com' does not exist or one of its queried reference-property objects are not present.",
    "innerError": {
      "request-id": "a6677627-0a77-4dc2-9ac6-356882803925",
      "date": "2019-12-23T16:33:25"
    }
  }
}

 

===========================

whole thing I would to check if user exists>yes or no. if does exit, if not create user. 

 

I am using UPN in get user field. If I remove user from AAD, works fine.

 

get_user.png

  • Verified answer
    v-bacao-msft Profile Picture
    on at
    Re: get user (AAD) error 404

     

    Hi @usarif ,

     

    Variables cannot be initialized in Apply to each.

    You could use expression directly in Condition to get statusCode. And set configure run after in Condition.

    Image reference:

    214.PNG

     

    Best Regards,

  • usarif Profile Picture
    195 on at
    Re: get user (AAD) error 404

    i am getting error when trying to create action Initialize variable after get user "the operation initialize variable can only be used at top level"

  • efisher Profile Picture
    52 on at
    Re: get user (AAD) error 404

    I see! yes your condition is not correct one you should check if the status code is 404

    to do this you will need to Initialize variable (integer) and set it to the following expression: outputs('Get_user')['statusCode']

    now in your condition you will check if the statusCode is equal to 404, make sure your Initialize variable is also Configured to run after success or fail.

     

    statusCode.PNG

  • Verified answer
    efisher Profile Picture
    52 on at
    Re: get user (AAD) error 404

    @usarif 

    When you check if the user in AD the action will result in true (user is in AD) or false (user is not in AD),in your screenshot the user you are checking for is not in AD so the response is correct - false or it will show up as failed action.

    Now in your condition if the Response code is 404 then create new user otherwise update item in SP

    below is screenshot of the old flow that's been running since last December - I am checking if there is ID in the body of the result using this formula: @not(empty(body('Get_user')?['id']))

    First image: user is in AD - I add them to SP security group

    Second one: user is Not in AD - create as guest user in AD, pause, add to SP security group send invitation 

     

    UserInAD.PNG

     

    User not in AD

    UserNotAD.PNG

  • usarif Profile Picture
    195 on at
    Re: get user (AAD) error 404

    I think issue is in condition after get user azure. I couldn't find output from get user. what condition qualify here.

    get_user.png

     

     

  • usarif Profile Picture
    195 on at
    Re: get user (AAD) error 404

    still getting same error even choose the option to "Configure run after" to run

  • efisher Profile Picture
    52 on at
    Re: get user (AAD) error 404

    @usarif you need to change settings on you condition step and "Configure run after" to run after checking for your user is ether successful or failed 

    check.PNG

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1