Authenticated Enumeration
Microsoft Graph Module
Connect to MS Graph
Login pop-up
Connect-MgGraphUse token
$Token = eyJ0
Connect-MgGraph -AccessToken ($Token | ConvertTo-SecureString -AsPlainText -Force)Get a Token
$passwd = ConvertTo-SecureString "Password123!" -AsPlainText -Force
$creds = New-Object System.management.automation.pscredential ("[email protected]", $passwd)
Connect-AzAccount -Credential $creds
$Token = (Get-AzAccessToken -ResourceTypeName MSGraph).token
$tokenSimple script to automate process
# Prompt for Email
$email = Read-Host "Enter your email address"
# Prompt for Password (input is hidden)
$password = Read-Host "Enter your password" -AsSecureString
# Create a PSCredential object
$creds = New-Object System.Management.Automation.PSCredential ($email, $password)
# Connect to Azure Account
Connect-AzAccount -Credential $creds
# Get the Access Token for MSGraph
$Token = (Get-AzAccessToken -ResourceTypeName MSGraph).Token
# Output the token (optional)
Write-Host "Access Token for Mg-Graph:" $TokenUsers
Enumerate all users
Enumerate specific user
Search for users who contain the word "admin" in their Display name:
All users who are synced from on-prem:
Objects owned by a specific user:
If a normal user owns a object with a sensitive role such as "Global Administrator', the normal user is indirectly a GA as well!
Groups
Get goups and roles where specified user is a member of
Get Members of a group:
Roles
Get all available role templates
Get users who have a specific role such as Global Administrator:
User assigned roles:
Devices
List owners of all the devices
List devices registered by a user
List devices managed using Intune
Applications (Registered Applications)
Get all applications objects registered with the current tenant
The Get-MgApplication will show all the applications details including password but password value is not shown. List all the apps with an application password
Service Principals (Enterprise Applications)
Get All Service Principals:
Via Graph token:
Administrative Unit
Get the administrative units:
Get the scoped role member:
Get Role ID
Get M365 license
Az PowerShell
A module from Microsoft for managing Azure resources.
Connect to Entra ID first:
Using credentials from Command Line
Or:
Or use a token:
General context
Get information about the current context:
List all available contexts
Enumerate all resources visible to the current user:
Enumerate all Azure RBAC role assignments
VMs
Get all VMs that our context can READ:
App Registrations
Storage Accounts
Key Vaults
Automated script
Example output:

Azure CLI
A set of commands used to create and manage Azure resources. Can be installed on multiple platforms and can be used with multiple clouds.
Login using creds:
Get users
Last updated