Get-EntraContext

現在のセッションに関する情報を取得する

構文

GetQuery (既定)

Get-EntraContext

説明

Get-EntraContext は、次のような現在のセッションに関する詳細を取得するために使用されます。

  • ClientID
  • TenantID
  • 証明書拇印
  • 同意されたスコープ
  • AuthType: 委任またはアプリのみ
  • AuthProviderType
  • CertificateName
  • アカウント
  • アプリ名
  • ContextScope
  • Certificate
  • PSHostVersion
  • ClientTimeOut。

Get-EntraCurrentSessionInfoGet-EntraContext の別名です。

例 1: 現在のセッションを取得する

Get-EntraContext
EntraPSModuleName     : Microsoft.Entra.Authentication
EntraPSVersion        : 1.0.1
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

この例では、現在のセッションの詳細を取得する方法を示します。

例 2: 現在のセッション スコープを取得する

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

すべてのスコープを取得します。