Skip to content

Instantly share code, notes, and snippets.

Avatar

Darren Robinson darrenjrobinson

View GitHub Profile
@darrenjrobinson
darrenjrobinson / Get AAD FIDO2 Token Details.ps1
Last active Oct 6, 2021
Get FIDO2 Tokens Azure Active Directory Passwordless configuration details using PowerShell. Associated blogpost https://blog.darrenjrobinson.com/what-does-your-azure-ad-fido2-passwordless-credential-look-like/
View Get AAD FIDO2 Token Details.ps1
#Install-Module MSAL.PS
Import-Module MSAL.PS
$resource = "https://graph.windows.net" # AzureAD Graph
$apiVersion = "api-version=1.6-internal" # Internal API
$scope = "user_impersonation" # Delegated User Impersonation
$clientID = "1b730954-1685-4b74-9bfd-dac224a7b894" # PowerShell
$tenantID = "yourcompanyAADName.com" # AAD
$myUPN = "useruserUPN@yourcompanyAADName.com" # User UPN
@darrenjrobinson
darrenjrobinson / Get-AzureADAuthenticationMethods.ps1
Last active Oct 5, 2021
PowerShell script to retrieve Azure AD Users Authentication Methods and add them as additional attributes on the User Object. Associated Blogpost https://blog.darrenjrobinson.com/reporting-on-users-azure-ad-authentication-methods-using-microsoft-graph-and-powershell/
View Get-AzureADAuthenticationMethods.ps1
Function AuthN {
<#
.SYNOPSIS
Authenticate to Azure AD and receieve Access and Refresh Tokens.
.DESCRIPTION
Authenticate to Azure AD and receieve Access and Refresh Tokens.
.PARAMETER tenantID
(required) Azure AD TenantID.
@darrenjrobinson
darrenjrobinson / Azure LogAnalytics Report to CSV.ps1
Last active Oct 3, 2021
Azure Log Analytics Report using KQL via REST API with PowerShell output to CSV. Associated blogpost https://blog.darrenjrobinson.com/?p=39731
View Azure LogAnalytics Report to CSV.ps1
#The resource URI
$resource = "https://westus2.api.loganalytics.io"
#Your Client ID and Client Secret obtained when registering your WebApp
$clientid = "yourAADAppClientID"
$clientSecret = "yourAADAppClientSecret"
#Your Reply URL configured when registering your WebApp
$redirectUri = "https://localhost"
#Scope
$scope = "Data.Read"
Add-Type -AssemblyName System.Web
@darrenjrobinson
darrenjrobinson / Remove Powershell ISE AddOn.ps1
Created Oct 11, 2016
Remove Powershell ISE Vertical AddOn Tools
View Remove Powershell ISE AddOn.ps1
# list ISE Vertical AddOn Tools
$psISE.CurrentPowerShellTab.VerticalAddOnTools
# Add on name from the list retreived above
$addOnName = 'PowerGist'
# Check you've spelled it right and remove
$exists = $psISE.CurrentPowerShellTab.VerticalAddOnTools | where { $_.Name -eq $addOnName }
if ($exists) {
$psISE.CurrentPowerShellTab.VerticalAddOnTools.Remove($exists)
View getM365AppUserDetail.ps1
Function AuthN {
<#
.SYNOPSIS
Authenticate to Azure AD and receieve Access and Refresh Tokens.
.DESCRIPTION
Authenticate to Azure AD and receieve Access and Refresh Tokens.
.PARAMETER tenantID
(required) Azure AD TenantID.
View TestMIMADMAPorts.ps1
# Insert Test-Port Function here from https://gallery.technet.microsoft.com/scriptcenter/97119ed6-6fb2-446d-98d8-32d823867131
# UDP Ports to probe
$udpports = @()
$udpports += "464" #Kerberos
$udpports += "3268" #GC
$udpports += "3269" #GC
# TCP Ports to probe
$ports = @()
@darrenjrobinson
darrenjrobinson / GetStaleAADGuestAccounts.ps1
Last active Sep 8, 2021
Get all AAD B2B Guest Accounts which haven't signed in, in the last XX Days, or haven't accepted a B2B Guest Invitation in last XX Days. Associated Blogpost https://blog.darrenjrobinson.com/finding-stale-azure-ad-b2b-guest-accounts-based-on-lastsignindatetime
View GetStaleAADGuestAccounts.ps1
Function AuthN {
<#
.SYNOPSIS
Authenticate to Azure AD and receieve Access and Refresh Tokens.
.DESCRIPTION
Authenticate to Azure AD and receieve Access and Refresh Tokens.
.PARAMETER tenantID
(required) Azure AD TenantID.
@darrenjrobinson
darrenjrobinson / Get-Unifi-Details.ps1
Last active Aug 28, 2021
PowerShell Script to get Ubiquiti Unifi Sites, Devices and Active Clients. Associated blogpost https://blog.darrenjrobinson.com/accessing-your-ubiquiti-unifi-network-configuration-with-powershell/
View Get-Unifi-Details.ps1
# Unifi Controller Login Base URI
$uController = 'yourControllerIP' # e.g 'https://192.168.1.2:8443'
# Identifier of the site in UniFi. Set to default for the default site
$uSiteID = "default"
$uUsername = 'adminuser' # yourAdmin UserID
$uPassword = 'yourPassword' # yourAdmin User Password
$uAuthBody = @{"username" = $uUsername; "password" = $uPassword }
$uHeaders = @{"Content-Type" = "application/json" }
@darrenjrobinson
darrenjrobinson / Auth_Query_MSGraph_MSAL.py
Last active Aug 17, 2021
Authenticate and Query Microsoft Graph using MSAL and Python. Associated blogpost https://blog.darrenjrobinson.com/microsoft-graph-using-msal-with-python/
View Auth_Query_MSGraph_MSAL.py
import msal
import jwt
import json
import requests
import pandas as pd
from datetime import datetime
accessToken = None
requestHeaders = None
tokenExpiry = None
View SailPoint IdentityNow PowerShell Module Examples.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.