Created
February 6, 2025 22:36
-
-
Save dky/0d8cc9aa0245718d0baaba8afc5b0a63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure you have a valid Kerberos ticket using kinit or equivalent | |
$uri = "https://your-service.example.com" | |
# Get the Kerberos authentication token using the System.Net.HttpListenerContext | |
$kerberosToken = [System.Net.CredentialCache]::DefaultNetworkCredentials | |
# Make the web request with the Authorization header set to the Kerberos token | |
$response = Invoke-WebRequest -Uri $uri -Headers @{ | |
"Authorization" = "Negotiate $($kerberosToken.GetCredential($uri, 'Negotiate').Password)" | |
} | |
# Output response | |
$response.Content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment