Coder Social home page Coder Social logo

cparker-msft / appimpersonationusersreport Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 22 KB

Report of M365 3rd party EWS applications using accounts that have the ApplicationImpersonation RBAC role assigned

License: MIT License

PowerShell 100.00%

appimpersonationusersreport's Introduction

appImpersonationUsersReport

Report of M365 3rd party EWS applications using accounts that have the ApplicationImpersonation RBAC role assigned

Description

The high-level overview of what this script does is the following:

  1. Get the list of accounts with the ApplicationImpersonation RBAC (Role Based Access Control) role via the Get-ManagementRoleAssignement cmdlet
  2. For each account returned in Step 1, get its UPN and SID using the Get-User cmdlet
  3. Do a Unified Audit Log search over a given time period using the Searc-UnifiedAuditLog cmdlet, filtering on the MailItemsAccessed operation
  4. For each SID, review UAL results for events with the SID as LogonUserSid and a different UPN for the MailboxOwnerUPN mailbox
  5. Log hits along with the AppId
  6. Perform some filtering and deduplication so that we're outputting the impersonation accounts in use by a given App Id, effectively performing the Impersonation account -> Application mapping

Usage

Step 1: Connect to Exchange Online PowerShell:

PS C:\Users\MyUser\Scripts> Connect-ExchangeOnline -UserPrincipalName admin@contoso.com

Step 2: Run the script from the local directory in a PowerShell terminal:

PS C:\Users\MyUser\Scripts> .\appImpersonationUsersReport.ps1

Execution policy issues

Depending on your execution policy, you may encounter an error when attempting to run the script. For more info on how to resolve this, please reference: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.security/get-executionpolicy?view=powershell-7.4

Disclaimer

THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

appimpersonationusersreport's People

Contributors

cparker-msft avatar

Stargazers

 avatar  avatar Alexandru Liviu Nita avatar

Watchers

 avatar  avatar

appimpersonationusersreport's Issues

MS 1st Party Apps are available in the report.

In the export, could see the 1st Party Apps available in the report. Can this be removed so that we have the exact inventory of the apps that are originally impacted.

00000003-0000-0000-c000-000000000000
00000002-0000-0ff1-ce00-000000000000
13937bba-652e-4c46-b222-3003f4d1ff97
a3883eba-fbe9-48bd-9ed3-dca3e0e84250

All above are internal apps to MS, but they are available in the export from the script output.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.