Zum Inhalt
Kaffeeundcode
Skriptbibliothek
PowerShell 06.10.2026

PowerShell

Invoke GraphRequest

83_Invoke-GraphRequest.ps1

<#
.SYNOPSIS
    Führt einen rohen Graph-Request aus.

.DESCRIPTION
    <!-- library-status:start -->
    Prüfstatus: Ungeprüft
    Windows- und Tenant-Abnahme ausstehend; keine pauschale Produktionsfreigabe.

    <!-- library-status:end -->

    Wrapper um Invoke-MgGraphRequest für benutzerdefinierte Abfragen.
    Flexibel für alle Endpunkte.

.NOTES
    File Name: 83_Invoke-GraphRequest.ps1
    Author: Mattia Cirillo
    Version: 1.0
#>

param (
    [string]$Uri,
    [string]$Method = "GET",
    [hashtable]$Body
)

Connect-MgGraph

if ($Body) {
    Invoke-MgGraphRequest -Method $Method -Uri $Uri -Body $Body
} else {
    Invoke-MgGraphRequest -Method $Method -Uri $Uri
}