Skip to content

Instantly share code, notes, and snippets.

@ChrFrohn
Created June 20, 2026 15:22
Show Gist options
  • Select an option

  • Save ChrFrohn/3b3249739b6a4a053cc3cb334aaa1f72 to your computer and use it in GitHub Desktop.

Select an option

Save ChrFrohn/3b3249739b6a4a053cc3cb334aaa1f72 to your computer and use it in GitHub Desktop.
using namespace System.Net
param($Request, $TriggerMetadata)
$UserPrincipalNameOrObjectId = $Request.Body.UserPrincipalNameOrObjectId
if (-not $UserPrincipalNameOrObjectId) {
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::BadRequest
Body = "ERROR: UserPrincipalNameOrObjectId is required in the request body"
})
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment