Code Monkey home page Code Monkey logo

pimscan's Introduction

A tool to create reports on Entra ID Role Assignments.

Prerequisites

  • PowerShell Module: MSAL.PS
Install-module MSAL.PS -Scope CurrentUser -Force -Confirm:$False

Minumum Permissions with limited data

  • Use the parameter -LimitedReadOnly, .\PIMSCAN.ps1 -TenantId [Tenant ID] -Show -verbose -LimitedReadOnly

  • Global Reader role

  • Consent for these:

    • AdministrativeUnit.Read.All
    • Directory.Read.All
    • Group.Read.All
    • PrivilegedAccess.Read.AzureAD
    • PrivilegedAccess.Read.AzureADGroup
    • PrivilegedAccess.Read.AzureResources
    • PrivilegedAssignmentSchedule.Read.AzureADGroup
    • PrivilegedEligibilitySchedule.Read.AzureADGroup
    • RoleAssignmentSchedule.Read.Directory
    • RoleEligibilitySchedule.Read.Directory
    • RoleManagement.Read.All
    • RoleManagement.Read.Directory
    • RoleManagementAlert.Read.Directory
    • RoleManagementPolicy.Read.Directory
    • RoleManagementPolicy.Read.AzureADGroup
    • User.Read
    • User.Read.All
    • offline_access

Run the following grant command as a Global Admin to grant a specific user the read-only scopes.

Install-Module Microsoft.Graph -Scope CurrentUser

connect-MgGraph -Scopes "Directory.AccessAsUser.All" -TenantId "<Your Tenant ID>"

$scopesOnlyRead = "AdministrativeUnit.Read.All Directory.Read.All Group.Read.All PrivilegedAccess.Read.AzureAD PrivilegedAccess.Read.AzureADGroup PrivilegedAccess.Read.AzureResources PrivilegedAssignmentSchedule.Read.AzureADGroup PrivilegedEligibilitySchedule.Read.AzureADGroup RoleAssignmentSchedule.Read.Directory RoleEligibilitySchedule.Read.Directory RoleManagement.Read.All RoleManagement.Read.Directory RoleManagementAlert.Read.Directory RoleManagementPolicy.Read.Directory RoleManagementPolicy.Read.AzureADGroup User.Read User.Read.All offline_access"
$params = @{
     # Microsoft Graph Command Line Tools
     ClientId = "4ad243ae-ea7f-4496-949e-4c64f1e96d71"
     # Singe User Consent
     ConsentType = "Principal"
     # Prinicpal to allow consent for
     PrincipalId = "<Prinicipal Object ID>"
     # GraphAggregatorService
     ResourceId = "4131d640-34dd-4690-ad11-45ddcd773304"
     # List of scopes/permissions
     Scope =  $scopesOnlyRead
}

New-MgOauth2PermissionGrant -BodyParameter $params

You will not be able to collect the data in the table below with Read-Only

Object Attribute Description Required Permission
roleAssignmentScheduleRequests justification Supplied justification RoleEligibilitySchedule.ReadWrite.Directory
roleAssignmentScheduleRequests status State of the request RoleEligibilitySchedule.ReadWrite.Directory
roleAssignmentScheduleRequests createdDateTime Creation date of the request RoleEligibilitySchedule.ReadWrite.Directory
roleEligibilityScheduleRequests justification Supplied justification RoleEligibilitySchedule.ReadWrite.Directory
roleEligibilityScheduleRequests status State of the request RoleEligibilitySchedule.ReadWrite.Directory
roleEligibilityScheduleRequests createdDateTime Creation date of the request RoleEligibilitySchedule.ReadWrite.Directory

Full access with Write scopes for roleAssignmentScheduleRequests and roleEligibilityScheduleRequests.

  • You must have or be able to consent to the following scopes for the enterprise app Microsoft Graph Command Line Tools

    • AdministrativeUnit.Read.All
    • Directory.Read.All
    • Group.Read.All
    • PrivilegedAccess.Read.AzureAD
    • PrivilegedAccess.Read.AzureADGroup
    • PrivilegedAccess.Read.AzureResources
    • PrivilegedAssignmentSchedule.Read.AzureADGroup
    • PrivilegedEligibilitySchedule.Read.AzureADGroup
    • RoleAssignmentSchedule.Read.Directory
    • RoleAssignmentSchedule.ReadWrite.Directory
    • RoleEligibilitySchedule.Read.Directory
    • RoleEligibilitySchedule.ReadWrite.Directory
    • RoleManagement.Read.All
    • RoleManagement.Read.Directory
    • RoleManagementAlert.Read.Directory
    • RoleManagementPolicy.Read.Directory
    • RoleManagementPolicy.Read.AzureADGroup
    • User.Read
    • User.Read.All
    • offline_access

Run the following grant command as a Global Admin to grant a specific user the read-only scopes.

Install-Module Microsoft.Graph -Scope CurrentUser

connect-MgGraph -Scopes "Directory.AccessAsUser.All" -TenantId "<Your Tenant ID>"

$scopesWrite = "AdministrativeUnit.Read.All Directory.Read.All Group.Read.All PrivilegedAccess.Read.AzureAD PrivilegedAccess.Read.AzureADGroup PrivilegedAccess.Read.AzureResources PrivilegedAssignmentSchedule.Read.AzureADGroup PrivilegedEligibilitySchedule.Read.AzureADGroup RoleAssignmentSchedule.Read.Directory RoleAssignmentSchedule.ReadWrite.Directory RoleEligibilitySchedule.Read.Directory RoleEligibilitySchedule.ReadWrite.Directory RoleManagement.Read.All RoleManagement.Read.Directory RoleManagementAlert.Read.Directory RoleManagementPolicy.Read.Directory RoleManagementPolicy.Read.AzureADGroup User.Read User.Read.All offline_access"

$params = @{
     # Microsoft Graph Command Line Tools
     ClientId = "4ad243ae-ea7f-4496-949e-4c64f1e96d71"
     # Singe User Consent
     ConsentType = "Principal"
     # Prinicpal to allow consent for
     PrincipalId = "<Prinicipal Object ID>"
     # GraphAggregatorService
     ResourceId = "4131d640-34dd-4690-ad11-45ddcd773304"
     # List of scopes/permissions
     Scope =  $scopesWrite
}

New-MgOauth2PermissionGrant -BodyParameter $params

Usage

Read-Only Limited

.\PIMSCAN.ps1 -TenantId <TenantID> -Show -Verbose -LimitedReadOnly

Get all data

.\PIMSCAN.ps1 -TenantId <TenantID> -Show -Verbose

Results are saved in a HTML file.

Open the Entra_ID_Role_Report_[TenantID].html if you did not used the -Show parameter.


pimscan's People

Contributors

canix1 avatar

Stargazers

 avatar Rafał Fitt avatar manu ^^ avatar  avatar Le DAC avatar r00tp avatar Jean-Benoit Paux avatar Samuel avatar Splinter_rat avatar  avatar RAMBAL Alexandre avatar  avatar Nicolas Vincent avatar Patrick Horne avatar  avatar Gustav Alerby avatar gvzr avatar Jonas H. avatar 0x023 avatar  avatar Iain Funnell (yowie) avatar  avatar Till avatar  avatar  avatar  avatar Sandro Bac avatar Jonathan17 avatar  avatar  avatar Mike avatar gtedavid avatar crusher avatar Ti_punch avatar Justin Grote avatar  avatar David avatar Mohamed Chorfa avatar Anders Kristiansen avatar Ian S avatar AlrikRr avatar Venopsis avatar  avatar  avatar  avatar Ser'Jean Anthony avatar Thibault Chatiron avatar  avatar Nik avatar  avatar Trevor Johnson avatar Julian Pawlowski avatar  avatar --Lol-- avatar  avatar Deepak Nagargoje avatar Aslak Ransby avatar Northvein avatar FSCorrupt avatar Patrick avatar Sebastian Werner avatar jj551 avatar  avatar Michael Wong avatar Ryota Sakai avatar  avatar  avatar  avatar Ramzi Zelfani avatar Jim avatar  avatar  avatar  avatar Alireza Tavakoli avatar  avatar Wes MacDonald avatar z3al avatar  avatar  avatar xsorl avatar  avatar Kay Daskalakis avatar Anderson Vieira avatar Tomas Rzepka avatar Emanuel Palm avatar

Watchers

 avatar  avatar GitHub - coo avatar  avatar

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.