Get-EntraContext
Retrieve information about your current session
Syntax
Get-EntraContext
[-ProgressAction <ActionPreference>]
[<CommonParameters>]
Description
Get-EntraContext
is used to retrieve the details about your current session, which include:
- ClientID
- TenantID
- Certificate Thumbprint
- Scopes consented to
- AuthType: Delegated or app-only
- AuthProviderType
- CertificateName
- Account
- AppName
- ContextScope
- Certificate
- PSHostVersion
- ClientTimeOut.
Get-EntraCurrentSessionInfo
is an alias for Get-EntraContext
.
Examples
Example 1: Get the current session
Get-EntraContext
ClientId : 11112222-bbbb-3333-cccc-4444dddd5555
TenantId : aaaabbbb-0000-cccc-1111-dddd2222eeee
CertificateThumbprint :
Scopes : {User.ReadWrite.All,...}
AuthType : Delegated
AuthProviderType : InteractiveAuthenticationProvider
CertificateName :
Account : SawyerM@Contoso.com
AppName : Microsoft Graph PowerShell
ContextScope : CurrentUser
Certificate :
PSHostVersion : 5.1.17763.1
ClientTimeout : 00:05:00
This example demonstrates how to retrieve the details of the current session.
Example 2: Get the current session scopes
Get-EntraContext | Select -ExpandProperty Scopes
AppRoleAssignment.ReadWrite.All
Directory.AccessAsUser.All
EntitlementManagement.ReadWrite.All
Group.ReadWrite.All
openid
Organization.Read.All
profile
RoleManagement.ReadWrite.Directory
User.Read
User.ReadWrite.All
Retrieves all scopes.
Parameters
-ProgressAction
Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |