Microsoft Graph
Microsoft Graph is the gateway to data and intelligence in Microsoft cloud services like Microsoft Entra and Microsoft 365.
Microsoft Graph exposes REST APIs and client libraries to access data
Working with users in Microsoft Graph
Microsoft Graph is the gateway to data and intelligence in Microsoft cloud services like Microsoft Entra and Microsoft 365.
Microsoft Graph exposes REST APIs and client libraries to access data
Working with users in Microsoft Graph
Import-Module Microsoft.Graph.Users
# A UPN can also be used as -UserId.
Get-MgUser -UserId $userId
Import-Module Microsoft.Graph.Users
$params = @{
businessPhones = @(
"+1 425 555 0109"
)
officeLocation = "18/2111"
}
Update-MgUser -UserId $userId -BodyParameter $params
Import-Module Microsoft.Graph.Users
Remove-MgUser -UserId $userId
You can use Microsoft Graph PowerShell to retrieve the default token lifetimes.
Example: Connect to Microsoft Graph
Connect-MgGraph -Scopes "Policy.Read.All"
Example: Check Default Token Lifetime Policies
Get-MgPolicyTokenLifetimePolicy
Check policies applied to a specific service principal (app)
Get-MgServicePrincipal -Filter "DisplayName eq 'Your-App-Name'" | Get-MgServicePrincipalTokenLifetimePolicy