Skip to content

Instantly share code, notes, and snippets.

@m8r1us
Created February 19, 2024 13:11
Show Gist options
  • Save m8r1us/0fe307dbbc162f12706dba2f43ec9c4e to your computer and use it in GitHub Desktop.
Save m8r1us/0fe307dbbc162f12706dba2f43ec9c4e to your computer and use it in GitHub Desktop.
MSGRAPH to AzureManagementToken
$TenantId = ""
$authUrl = "https://login.microsoftonline.com/$($TenantId)"
$body = @{
"scope" = "https://management.azure.com/.default offline_access openid"
"client_id" = "d3590ed6-52b3-4102-aeff-aad2292ab01c"
"grant_type" = "refresh_token"
"refresh_token" = ""
}
$token = Invoke-RestMethod -UseBasicParsing -Method Post -Uri "$($authUrl)/oauth2/v2.0/token" -Headers $Headers -Body $body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment