web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get user activity via ...
Power Automate
Answered

Get user activity via HTTP request.

(0) ShareShare
ReportReport
Posted on by 26

Hello all,

what should be the HTTP query to retrieve the login activity of a specific user?

ektoplasma24_0-1673366934865.png

 

My app is authorized in AAD as follows, 

ektoplasma24_1-1673367010508.png

 

 

The audit log is also enabled.

 

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,194 Most Valuable Professional on at

    Hi @ektoplasma24,


    Can you remove the curly brackets {} and try again?

  • ektoplasma24 Profile Picture
    26 on at

    @Expiscornovus 

    without the brackets I get the following error message, 

    ektoplasma24_0-1673370040095.png

     

  • Expiscornovus Profile Picture
    33,194 Most Valuable Professional on at

    Hi @ektoplasma24,

     

    Apologies for the confusion. I forgot it is a beta method and the property is called signInActivity, not signIn:

    https://learn.microsoft.com/en-us/azure/active-directory/reports-monitoring/howto-manage-inactive-user-accounts#how-to-detect-inactive-user-accounts

     

     

    Try something like below:

     

    https://graph.microsoft.com/beta/users/youruserid/?$select=displayName,userPrincipalName,signInActivity

     

  • Expiscornovus Profile Picture
    33,194 Most Valuable Professional on at

    Hi @ektoplasma24,

     

    And in case you are talking about audit logs signIns, you could use the below. I really need some coffee 😅

     

     

    https://graph.microsoft.com/v1.0/auditlogs/signIns?$filter=userId eq 'youruserid'

     

  • ektoplasma24 Profile Picture
    26 on at

    Hi, @Expiscornovus

    thanks for your help, I think there is not much left to solve this puzzle. 😄
    I got another error, I think that is because I was not registered as an app owner. - changed that now.
    Subsequently, I've triggered the workflow again unfortunately without success the error remains... 

    ektoplasma24_0-1673371178225.png

    URL is now, 

    https://graph.microsoft.com/beta/users/6da38f53-ff1d-445b-8a06-262cc******/?$select=displayName,userPrincipalName,signInActivity

     

    Error message, 

    {
     "error": {
     "code": "Authentication_MSGraphPermissionMissing",
     "message": "Calling principal does not have required MSGraph permissions AuditLog.Read.All",
     "innerError": {
     "date": "2023-01-10T17:13:05",
     "request-id": "bf8158c3-bee3-40d8-8941-f3456011a25d",
     "client-request-id": "bf8158c3-bee3-40d8-8941-f3456011a25d"
     }
     }
    }
  • ektoplasma24 Profile Picture
    26 on at

    @Expiscornovus 

    I've got the same error as in the last post. 

    I only would like to know when the user has logged in the last time..  seems to be difficult 😂

  • Expiscornovus Profile Picture
    33,194 Most Valuable Professional on at

    Hi @ektoplasma24,

     

    There is a lot more to troubleshoot. For example, what type of authentication have you configured in the Authentication settings of the HTTP action?

     

    Since you were talking about an App, I assume you are using OAuth in the HTTP action configuration?

     

    Have you double checked you are using the correct client id, client secret, tenant id, etc.? 

     

    adappreg.png

     

     

     

  • ektoplasma24 Profile Picture
    26 on at

    @Expiscornovus 

    Tenant-ID and Client ID are correct - checked them twice 😅

    ektoplasma24_0-1673372187244.png

     

  • Verified answer
    Expiscornovus Profile Picture
    33,194 Most Valuable Professional on at

    Hi @ektoplasma24,

     

    Just tested the signinActivity resource one. If it helps below is my setup and my test result. So, in theory it should work for you as well. Just need to find what is different in your setup.

     

    Below is my test setup.

     

    lastsignin02.png

     

    2. My test result

     

    lastsignin.png

  • ektoplasma24 Profile Picture
    26 on at

    @Expiscornovus 

    I've deleted the HTTP Action and set it up again, now it works.

    Thanks for your ambitions.❤️

    Now you have a new follower 😋

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard