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
Import-Module MSAL.PS | |
Import-Module AzureADTenantID | |
# Use the Azure PowerShell Well-Known Client ID | |
$clientID = "1950a258-227b-4e31-a9cf-717495945fc2" | |
# Get UserUPN | |
$userUPN = Read-Host -Prompt "Please enter Azure AD User UPN" | |
$tenantName = $userUPN.Split("@")[1] | |
$tenantID = Get-AzureADTenantId -domain $tenantName |
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
using namespace System.Net | |
# Input bindings are passed in via param block. | |
param($Request, $TriggerMetadata) | |
# Write to the Azure Functions log stream. | |
Write-Host "PowerShell AzureAD Query HTTP trigger function received a request." | |
Write-Host $Request.Body | |
# Write-Host $Request.Query |
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
# Input bindings are passed in via param block. | |
param($Timer) | |
# Get the current universal time in the default string format | |
$currentUTCtime = (Get-Date).ToUniversalTime() | |
# The 'IsPastDue' porperty is 'true' when the current function invocation is later than scheduled. | |
if ($Timer.IsPastDue) { | |
Write-Host "PowerShell timer is running late!" | |
} |
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
using namespace System.Net | |
# Input bindings are passed in via param block. | |
param($Request, $TriggerMetadata) | |
# Write to the Azure Functions log stream. | |
Write-Host "PowerShell HTTP trigger function received a new Azure AD Change Notification." | |
# Convert Notification Details to a PSObject | |
$objNotification = ($Request.RawBody | convertfrom-json).value |
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
# Notifidcation Configuration | |
$expiryMaxLength = 3 | |
$expiryHours = ($expiryMaxLength * 24) / 2 | |
$clientStateValue = New-Guid | |
$notificationExpiry = (get-date).addHours($expiryHours).ToUniversalTime() | |
$utcExpiry = get-date $notificationExpiry -Format yyyy-MM-ddThh:mm:ss.0000000Z | |
# AAD User and Application Configuration | |
$graphAutomationClientID = "azureADApplicationClientID" | |
$graphAutomationSecret = "azureADApplicationSecret" |
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
Clear-Host | |
# Client ID obtained after registering here https://upgrade.yubico.com/getapikey/ | |
$clientID = '12345' | |
# Read in the key | |
$getKey = Read-Host 'Insert your YubiKey and touch it until the OTP is received (~2 seconds)' | |
$credentialID = $getKey.Substring(0, 12) | |
# Generate a Nonce | |
$nonce = -join ((65..90) + (97..122) | Get-Random -Count 32 | ForEach-Object { [char]$_ }) | |
$nonce = $nonce.ToLower() |
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
import msal | |
import jwt | |
import json | |
import sys | |
import requests | |
from datetime import datetime | |
global accessToken | |
global requestHeaders | |
global tokenExpiry |
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
param ( | |
$Username, | |
$Password, | |
$Credentials, | |
$AuxUsername, | |
$AuxPassword, | |
$AuxCredentials, | |
$ConfigurationParameter, | |
$OperationType, | |
[bool] $usepagedimport, |
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
$obj = New-Object -Type PSCustomObject | |
$obj | Add-Member -Type NoteProperty -Name "Anchor-Employee ID|String" -Value "" | |
$obj | Add-Member -Type NoteProperty -Name "objectClass|String" -Value "person" | |
$obj | Add-Member -Type NoteProperty -Name "First Name|string" -Value "string" | |
$obj | Add-Member -Type NoteProperty -Name "Last Name|string" -Value "string" | |
$obj | Add-Member -Type NoteProperty -Name "Title|string" -Value "string" | |
$obj | Add-Member -Type NoteProperty -Name "Department|string" -Value "string" | |
$obj | Add-Member -Type NoteProperty -Name "Employee Type|string" -Value "string" | |
$obj | Add-Member -Type NoteProperty -Name "Employment Start Date|string" -Value "string" | |
$obj | Add-Member -Type NoteProperty -Name "Employment End Date|string" -Value "string" |
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
import msal | |
import jwt | |
import json | |
import sys | |
import requests | |
from datetime import datetime | |
from msal_extensions import * | |
graphURI = 'https://graph.microsoft.com' | |
tenantID = 'yourTenantID' |