Condividi tramite


Microsoft Entra ID Protection e Microsoft Graph PowerShell

Microsoft Graph è l'endpoint dell'API unificata Microsoft e la home page di API microsoft Entra ID Protection. Questo articolo illustra come usare Microsoft Graph PowerShell SDK per gestire gli utenti rischiosi con PowerShell. Le organizzazioni che vogliono eseguire query sulle API Microsoft Graph direttamente possono usare l'articolo Esercitazione : Identificare e correggere i rischi usando le API Microsoft Graph per iniziare il percorso.

Prerequisiti

Per usare i comandi di PowerShell in questo articolo, sono necessari i prerequisiti seguenti:

  • Microsoft Graph PowerShell SDK è installato.

  • Ruolo amministratore della sicurezza .

  • IdentityRiskEvent.Read.All, IdentityRiskyUser.ReadWrite.All o IdentityRiskyUser.ReadWrite.All sono necessarie autorizzazioni delegate.

    • Per impostare le autorizzazioni su IdentityRiskEvent.Read.All e IdentityRiskyUser.ReadWrite.All, eseguire:
    Connect-MgGraph -Scopes "IdentityRiskEvent.Read.All","IdentityRiskyUser.ReadWrite.All"
    
  • Se si usa l'autenticazione solo app, vedere Usare l'autenticazione solo app con Microsoft Graph PowerShell SDK.

    • Per registrare un'applicazione con le autorizzazioni dell'applicazione necessarie, preparare un certificato ed eseguire:
    Connect-MgGraph -ClientID YOUR_APP_ID -TenantId YOUR_TENANT_ID -CertificateName YOUR_CERT_SUBJECT ## Or -CertificateThumbprint instead of -CertificateName
    

Elencare i rilevamenti a rischio con PowerShell

È possibile recuperare i rilevamenti dei rischi dalle proprietà di un rilevamento dei rischi in Protezione ID.

# List all anonymizedIPAddress risk detections
Get-MgRiskDetection -Filter "RiskType eq 'anonymizedIPAddress'" | Format-Table UserDisplayName, RiskType, RiskLevel, DetectedDateTime

# List all high risk detections for the user 'User01'
Get-MgRiskDetection -Filter "UserDisplayName eq 'User01' and RiskLevel eq 'high'" | Format-Table UserDisplayName, RiskType, RiskLevel, DetectedDateTime

Elencare gli utenti a rischio con PowerShell

È possibile recuperare gli utenti rischiosi e le relative cronologie rischiose in Protezione ID.

# List all high risk users
Get-MgRiskyUser -Filter "RiskLevel eq 'high'" | Format-Table UserDisplayName, RiskDetail, RiskLevel, RiskLastUpdatedDateTime

#  List history of a specific user with detailed risk detection
Get-MgRiskyUserHistory -RiskyUserId 00aa00aa-bb11-cc22-dd33-44ee44ee44ee | Format-Table RiskDetail, RiskLastUpdatedDateTime, @{N="RiskDetection";E={($_). Activity.RiskEventTypes}}, RiskState, UserDisplayName

Confermare la compromissione degli utenti con PowerShell

È possibile confermare che gli utenti sono stati compromessi e contrassegnarli come utenti ad alto rischio in Protezione ID.

# Confirm Compromised on two users
Confirm-MgRiskyUserCompromised -UserIds "11bb11bb-cc22-dd33-ee44-55ff55ff55ff","22cc22cc-dd33-ee44-ff55-66aa66aa66aa"

Ignorare gli utenti rischiosi usando PowerShell

È possibile ignorare in blocco gli utenti rischiosi in Protezione ID.

# Get a list of high risky users which are more than 90 days old
$riskyUsers= Get-MgRiskyUser -Filter "RiskLevel eq 'high'" | where RiskLastUpdatedDateTime -LT (Get-Date).AddDays(-90)
# bulk dismiss the risky users
Invoke-MgDismissRiskyUser -UserIds $riskyUsers.Id

Passaggi successivi