Last active
October 20, 2021 06:49
-
-
Save watahani/546d21ce1f0368bb90c6ab517843134e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$clientId = '<client-id>' | |
$clientSecret = '<client-secret>' | |
$tenantId = "<your-tenant-id>" | |
$scope = 'https://graph.microsoft.com/.default' | |
$tokenEndpoint = "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token" | |
$postParams = @{ | |
client_id = $clientId; | |
client_secret = $clientSecret; | |
grant_type = 'client_credentials'; | |
scope = $scope | |
} | |
$authResult = (Invoke-WebRequest -Uri $tokenEndpoint -Method POST -ContentType "application/x-www-form-urlencoded" -Body $postParams) | ConvertFrom-Json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment