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
# Documentation: https://learn.microsoft.com/en-us/graph/application-rollkey-prooftoken?tabs=powershell | |
# https://learn.microsoft.com/en-us/graph/api/application-addkey?view=graph-rest-1.0&tabs=http | |
function New-Prooftoken { | |
param ( | |
[Parameter(Mandatory = $true)] | |
[string]$clientId, | |
[Parameter(Mandatory = $true)] | |
[System.Security.Cryptography.X509Certificates.X509Certificate2]$cert | |
) |
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
function New-Pbkdf2Hash { | |
param ( | |
[Parameter(Mandatory = $true, Position = 0)] | |
[ValidateNotNull()] | |
[string]$toHash, | |
[Parameter(Mandatory = $true, Position = 1)] | |
[ValidateNotNull()] | |
[Securestring]$salt, |
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
$results = [System.Collections.Generic.List[Object]]::new() | |
# Batches Currently have a max Request Amount of 20 | |
for ($i = 0; $i -lt $users.Count; $i += 20) { | |
$batchObjects = $users[$i..($i + 19)] | |
$batch = @{} | |
$batch['requests'] = [System.Collections.Generic.List[Object]]::new() | |
$number = 0 | |
foreach ($id in $batchObjects.id){ | |
$batch['requests'].Add(@{ |
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
# Note: To use -publicClient you must explicitly enable public clients on the App Registration | |
# For details on why you should avoid this as much as Possible see https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth-ropc | |
function Connect-ROPCGraph { | |
param ( | |
[Parameter(ParameterSetName = "PublicClient", Mandatory = $true)] | |
[Parameter(ParameterSetName = "ClientCert", Mandatory = $true)] | |
[Parameter(ParameterSetName = "ClientCredentials", Mandatory = $true)] | |
[ValidateNotNull()] | |
[System.Management.Automation.PSCredential]$userCredentials, |