Skip to content

Instantly share code, notes, and snippets.

@magohl
Created August 15, 2022 15:47
Show Gist options
  • Save magohl/a2fa5c5c141ef76d660abb9a2f4f2ad4 to your computer and use it in GitHub Desktop.
Save magohl/a2fa5c5c141ef76d660abb9a2f4f2ad4 to your computer and use it in GitHub Desktop.
Fetch OAuth token using Managed Identity from Azure App Service
$ProgressPreference = "SilentlyContinue"
$tokenResponse = Invoke-WebRequest -UseBasicParsing -Headers @{"X-IDENTITY-HEADER"=$env:IDENTITY_HEADER} -Uri "$($env:IDENTITY_ENDPOINT)?resource=https://storage.azure.com/&api-version=2019-08-01"
$tokenResponse.RawContent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment