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
# This script will require the Web Application and permissions setup in Azure Active Directory | |
$ClientID = "client id" # Should be a ~35 character string insert your info here | |
$ClientSecret = "secret” # Should be a ~44 character string insert your info here | |
$loginURL = "https://login.microsoftonline.com" | |
$tenantdomain = "<tenantname>.onmicrosoft.com" # For example, contoso.onmicrosoft.com | |
$resource = "https://graph.microsoft.com" | |
# Get an Oauth 2 access token based on client id, secret and tenant domain | |
$body = @{grant_type="client_credentials";resource=$resource;client_id=$ClientID;client_secret=$ClientSecret} | |
$oauth = Invoke-RestMethod -Method Post -Uri $loginURL/$tenantdomain/oauth2/token -Body $body |
NewerOlder