Skip to content

Entra 上の Enterpriase Application 情報を取得する PowerShell コマンド

先日、macOS に PowerShell をインストールする というメモを書きました。 Entra 上の Enterprise Application 情報を PowerShell で取得するコマンドのシートシートをメモしておきます。

検証環境

対象 バージョン
macOS Sequoia 15.4.1

PowerShell を起動する

pwsh

テナントへ接続する

Connect-MgGraph -NoWelcome -TenantId 12345678-1234-1234-1234-1234567890AB -Scopes "Application.ReadWrite.All"

Entra 上に存在する全ユーザを表示する

Get-MgUser -All -Sort "DisplayName" | Format-Table DisplayName, UserPrincipalName, Id

特定ユーザの情報を表示する

Get-MgUser -UserId 12345678-1234-1234-1234-1234567890AB | Format-List

Enterprise Application の一覧を表示する

Get-MgApplication | Format-Table Id, DisplayName, AppId

特定 Enterprise Application の情報を表示する

Get-MgServicePrincipal -Filter "AppId eq '12345678-1234-1234-1234-1234567890AB'" | Format-Table Id, DisplayName, AppId

特定 Enterprise Application に割り当てられたユーザ一覧を表示する

Get-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId 12345678-1234-1234-1234-1234567890AB | Format-Table PrincipalDisplayName