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
# Connect via deviceauthentication and get the TenantID and User ObjectID | |
Connect-MgGraph -UseDeviceAuthentication | |
$context = Get-MgContext | |
$currentUser = (Get-MgUser -UserId $context.Account).Id | |
# Get all available roles | |
$myRoles = Get-MgRoleManagementDirectoryRoleEligibilitySchedule -ExpandProperty RoleDefinition -All -Filter "principalId eq '$currentuser'" | |
# Get SharePoint admin role info | |
$myRole = $myroles | Where-Object {$_.RoleDefinition.DisplayName -eq "SharePoint Service Administrator"} |
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
var jsonData = pm.response.json(); | |
pm.environment.set("jwt", jsonData.access_token); | |
function parseJwt (token,part) { | |
var base64Url = token.split('.')[part]; | |
var words = CryptoJS.enc.Base64.parse(base64Url); | |
var jsonPayload = CryptoJS.enc.Utf8.stringify(words); | |
return JSON.parse(jsonPayload); | |
}; |