@@ -149,6 +149,35 @@ curl "$IDENTITY_ENDPOINT?resource=https://management.azure.com&api-version=2017-
149149curl " $IDENTITY_ENDPOINT ?resource=https://vault.azure.net&api-version=2017-09-01" -H secret:$IDENTITY_HEADER
150150```
151151
152+ {{#endtab }}
153+ {{#tab name="MS Graph" }}
154+
155+ ``` bash
156+ Get-MgTenantRelationshipDelegatedAdminCustomer
157+ # Install the Microsoft Graph PowerShell module if not already installed
158+ Install-Module Microsoft.Graph -Scope CurrentUser
159+
160+ # Import the module
161+ Import-Module Microsoft.Graph
162+
163+ # Login to Microsoft Graph
164+ Connect-MgGraph -Scopes " User.Read.All" , " Group.Read.All" , " Directory.Read.All"
165+
166+ # Enumerate available commands in Microsoft Graph PowerShell
167+ Get-Command -Module Microsoft.Graph*
168+
169+ # Example: List users
170+ Get-MgUser -All
171+
172+ # Example: List groups
173+ Get-MgGroup -All
174+
175+ # Example: Get roles assigned to a user
176+ Get-MgUserAppRoleAssignment -UserId < UserId>
177+
178+ # Disconnect from Microsoft Graph
179+ Disconnect-MgGraph
180+ ```
152181{{#endtab }}
153182
154183{{#tab name="Azure AD" }}
@@ -266,6 +295,35 @@ curl -X GET "https://graph.microsoft.com/beta/roleManagement/directory/roleDefin
266295
267296{{# endtab }}
268297
298+ {{# tab name="MS Graph" }}
299+
300+ ` ` ` bash
301+ # Enumerate users using Microsoft Graph PowerShell
302+ Get-MgUser -All
303+
304+ # Get user details
305+ Get-MgUser -UserId " [email protected] " | Format-List * 306+
307+ # Search "admin" users
308+ Get-MgUser -All | Where-Object { $_ .DisplayName -like " *test*" } | Select-Object DisplayName
309+
310+ # Search attributes containing the word "password"
311+ Get-MgUser -All | Where-Object { $_ .AdditionalProperties.PSObject.Properties.Name -contains " password" }
312+
313+ # All users from Entra ID
314+ Get-MgUser -Filter " startswith(userPrincipalName, 't')" -All | Select-Object DisplayName, UserPrincipalName
315+
316+ # Get groups where the user is a member
317+ Get-MgUserMemberOf -UserId < UserId>
318+
319+ # Get roles assigned to the user in Entra ID
320+ Get-MgUserAppRoleAssignment -UserId < UserId>
321+
322+ # List available commands in Microsoft Graph PowerShell
323+ Get-Command -Module Microsoft.Graph.Users
324+ ` ` `
325+ {{# endtab }}
326+
269327{{#tab name="Azure AD" }}
270328
271329` ` ` bash
@@ -396,7 +454,34 @@ Get-AzRoleAssignment -ResourceGroupName <resource_group_name>
396454` ` `
397455
398456{{# endtab }}
457+ {{# tab name="MS Graph" }}
458+
459+ ` ` ` bash
460+ # Enumerate groups using Microsoft Graph PowerShell
461+ Get-MgGroup -All
462+
463+ # Get group details
464+ Get-MgGroup -GroupId < GroupId> | Format-List *
399465
466+ # Search "admin" groups
467+ Get-MgGroup -All | Where-Object { $_ .DisplayName -like " *admin*" } | Select-Object DisplayName
468+
469+ # Get members of a group
470+ Get-MgGroupMember -GroupId < GroupId> -All
471+
472+ # Get groups a group is member of
473+ Get-MgGroupMemberOf -GroupId < GroupId>
474+
475+ # Get roles assigned to the group in Entra ID
476+ Get-MgGroupAppRoleAssignment -GroupId < GroupId>
477+
478+ # Get group owner
479+ Get-MgGroupOwner -GroupId < GroupId>
480+
481+ # List available commands in Microsoft Graph PowerShell
482+ Get-Command -Module Microsoft.Graph.Groups
483+ ` ` `
484+ {{# endtab }}
400485{{#tab name="Azure AD" }}
401486
402487` ` ` bash
@@ -504,6 +589,31 @@ $RequestParams = @{
504589(Invoke-RestMethod @RequestParams).value
505590` ` `
506591
592+ {{# endtab }}
593+ {{# tab name="MS Graph" }}
594+
595+ ` ` ` bash
596+ # Get Service Principals using Microsoft Graph PowerShell
597+ Get-MgServicePrincipal -All
598+
599+ # Get details of one Service Principal
600+ Get-MgServicePrincipal -ServicePrincipalId < ServicePrincipalId> | Format-List *
601+
602+ # Search SP by display name
603+ Get-MgServicePrincipal -All | Where-Object { $_ .DisplayName -like " *app*" } | Select-Object DisplayName
604+
605+ # Get owner of Service Principal
606+ Get-MgServicePrincipalOwner -ServicePrincipalId < ServicePrincipalId>
607+
608+ # Get objects owned by a Service Principal
609+ Get-MgServicePrincipalOwnedObject -ServicePrincipalId < ServicePrincipalId>
610+
611+ # Get groups where the SP is a member
612+ Get-MgServicePrincipalMemberOf -ServicePrincipalId < ServicePrincipalId>
613+
614+ # List available commands in Microsoft Graph PowerShell
615+ Get-Command -Module Microsoft.Graph.ServicePrincipals
616+ ` ` `
507617{{# endtab }}
508618
509619{{#tab name="Azure AD" }}
@@ -691,6 +801,26 @@ Get-AzADAppCredential
691801
692802{{# endtab }}
693803
804+ {{# tab name="MS Graph" }}
805+
806+ ` ` ` bash
807+ # List Applications using Microsoft Graph PowerShell
808+ Get-MgApplication -All
809+
810+ # Get application details
811+ Get-MgApplication -ApplicationId 7861f72f-ad49-4f8c-96a9-19e6950cffe1 | Format-List *
812+
813+ # Search App by display name
814+ Get-MgApplication -Filter " startswith(displayName, 'app')" | Select-Object DisplayName
815+
816+ # Get owner of an application
817+ Get-MgApplicationOwner -ApplicationId < ApplicationId>
818+
819+ # List available commands in Microsoft Graph PowerShell
820+ Get-Command -Module Microsoft.Graph.Applications
821+ ` ` `
822+ {{# endtab }}
823+
694824{{# tab name="Azure AD" }}
695825
696826` ` ` bash
@@ -770,11 +900,32 @@ az role assignment list --all --query "[].{principalName:principalName,principal
770900# Get all the roles assigned to a user
771901az role assignment list --assignee " <email>" --all --output table
772902# Get all the roles assigned to a user by filtering
773- az role assignment list --all --query " [?principalName=='carlos@carloshacktricks .onmicrosoft.com']" --output table
903+ az role assignment list --all --query " [?principalName=='admin@organizationadmin .onmicrosoft.com']" --output table
774904` ` `
775905
776906{{# endtab }}
777907
908+ {{# tab name="MS Graph" }}
909+
910+ ` ` ` bash
911+
912+ # List all available role templates using Microsoft Graph PowerShell
913+ Get-MgDirectoryRoleTemplate -All
914+
915+ # List enabled built-in Entra ID roles
916+ Get-MgDirectoryRole -All
917+
918+ # List all Entra ID roles with their permissions (including custom roles)
919+ Get-MgDirectoryRoleDefinition -All
920+
921+ # List members of a Entra ID role
922+ Get-MgDirectoryRoleMember -DirectoryRoleId < RoleId> -All
923+
924+ # List available commands in Microsoft Graph PowerShell
925+ Get-Command -Module Microsoft.Graph.Identity.DirectoryManagement
926+ ` ` `
927+ {{# endtab }}
928+
778929{{# tab name="Az" }}
779930
780931` ` ` bash
@@ -894,6 +1045,25 @@ Get-AzureADMSScopedRoleMembership -Id <id> | fl *
8941045# If you know how to do this send a PR!
8951046` ` `
8961047
1048+ {{# endtab }}
1049+ {{# tab name="MS Graph" }}
1050+
1051+ ` ` ` bash
1052+ # Enumerate devices using Microsoft Graph PowerShell
1053+ Get-MgDevice -All
1054+
1055+ # Get device details
1056+ Get-MgDevice -DeviceId < DeviceId> | Format-List *
1057+
1058+ # Get devices managed using Intune
1059+ Get-MgDevice -Filter " isCompliant eq true" -All
1060+
1061+ # Get devices owned by a user
1062+ Get-MgUserOwnedDevice -UserId [email protected] 1063+
1064+ # List available commands in Microsoft Graph PowerShell
1065+ Get-Command -Module Microsoft.Graph.Identity.DirectoryManagement
1066+ ` ` `
8971067{{# endtab }}
8981068
8991069{{# tab name="Azure AD" }}
0 commit comments