Skip to content

Instantly share code, notes, and snippets.

View jesseloudon's full-sized avatar
:shipit:

Jesse Loudon jesseloudon

:shipit:
View GitHub Profile
@jesseloudon
jesseloudon / ADFS_ClaimRule_NameID_SPNameQualifier.txt
Last active February 6, 2020 00:23
ADFS_ClaimRule_NameID_SPNameQualifier.txt
c:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"]
=> issue(Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", Issuer = c.Issuer, OriginalIssuer = c.OriginalIssuer, Value = c.Value, ValueType = c.ValueType, Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format"] = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/spnamequalifier"] = "insertValueHere");
@jesseloudon
jesseloudon / ADFS_ClaimRule_EmailAddress.txt
Created April 3, 2019 01:03
ADFS_ClaimRule_EmailAddress.txt
c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"]
=> issue(store = "Active Directory", types = ("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"), query = ";mail;{0}", param = c.Value);
@jesseloudon
jesseloudon / ADFS_ClaimRule_NameID.txt
Created April 3, 2019 02:00
ADFS_ClaimRule_NameID.txt
c:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"]
=> issue(Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", Issuer = c.Issuer, OriginalIssuer = c.OriginalIssuer, Value = c.Value, ValueType = c.ValueType, Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format"] = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress");
@jesseloudon
jesseloudon / BitLocker-ActivateOnShutdown.ps1
Created January 7, 2020 02:05
BitLocker Activation Script
#Check BitLocker prerequisites
$TPMNotEnabled = Get-WmiObject win32_tpm -Namespace root\cimv2\security\microsofttpm | where {$_.IsEnabled_InitialValue -eq $false} -ErrorAction SilentlyContinue
$TPMEnabled = Get-WmiObject win32_tpm -Namespace root\cimv2\security\microsofttpm | where {$_.IsEnabled_InitialValue -eq $true} -ErrorAction SilentlyContinue
$WindowsVer = Get-WmiObject -Query 'select * from Win32_OperatingSystem where (Version like "6.2%" or Version like "6.3%" or Version like "10.0%") and ProductType = "1"' -ErrorAction SilentlyContinue
$BitLockerReadyDrive = Get-BitLockerVolume -MountPoint $env:SystemDrive -ErrorAction SilentlyContinue
$BitLockerDecrypted = Get-BitLockerVolume -MountPoint $env:SystemDrive | where {$_.VolumeStatus -eq "FullyDecrypted"} -ErrorAction SilentlyContinue
$BLVS = Get-BitLockerVolume | Where-Object {$_.KeyProtector | Where-Object {$_.KeyProtectorType -eq 'RecoveryPassword'}} -ErrorAction SilentlyContinue
#Step 1 - Check if TPM is enabled and initialise if required
@jesseloudon
jesseloudon / AzureProximityPlacementGroup-Demo.azcli
Created January 13, 2020 05:19
AzureProximityPlacementGroup AzureCLI Demo
az login
az account set -s "SUBSCRIPTIONID"
az account show -o json
#pre/post deployment discovery - if desired
az group list -o table
az vm availability-set list -o table
az network vnet list -o table
az storage account list -o table
az ppg list -o table
@jesseloudon
jesseloudon / VNET-AZCLI.azcli
Last active March 3, 2020 04:23
Deploy VNETs with AZCLI
#AuthN
az login
#Create RG
az group create -n "VNET-AZCLI-RG" -l "Australia East"
#Create Hub VNET
az network vnet create -n "msft-hub-vnet" --address-prefix "10.0.0.0/16" --subnet-name "firewall" --subnet-prefix "10.0.1.0/24" --dns-servers "10.0.2.4" "10.0.2.5" "168.63.129.16" --tags department="Central IT" managedBy="Admins" -g "VNET-AZCLI-RG"
az network vnet subnet create -n "ad" --address-prefix "10.0.2.0/24" --vnet-name "msft-hub-vnet" -g "VNET-AZCLI-RG"
az network vnet subnet create -n "mgmt" --address-prefix "10.0.3.0/24" --vnet-name "msft-hub-vnet" -g "VNET-AZCLI-RG"
@jesseloudon
jesseloudon / VNET-AZBB.json
Created March 3, 2020 04:00
Define VNETs with AZBB JSON
{
"$schema": "https://raw.githubusercontent.com/mspnp/template-building-blocks/master/schemas/buildingBlocks.json",
"contentVersion": "1.0.0.0",
"parameters": {
"buildingBlocks": {
"value": [
{
"type": "VirtualNetwork",
"settings": [
{
@jesseloudon
jesseloudon / VNET-AZBB.azcli
Created March 3, 2020 04:02
Deploy VNETs with AZCLI/AZBB
#AuthN
az login
#AZBB Deploy VNETs
azbb -g "VNET-AZBB-RG" -s "your-subscription-id" -l "your-azurelocation" -p "C:\Temp\Scripts\VNET-AZBB.json" --deploy
@jesseloudon
jesseloudon / AuditRoleAssignmentType.json
Last active May 16, 2020 14:10
Custom Azure Policy to Audit Role Assignment Type
{
"mode": "All",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Authorization/roleAssignments"
},
{
@jesseloudon
jesseloudon / AzureRoleAssignmentCleanup.ps1
Created May 20, 2020 01:58
Find and remove Azure RBAC Role Assignments of 'Unknown' Type.
#AuthN
Connect-AzAccount
#Set Your Subscription ID
Set-AzContext -SubscriptionId "XXXXX-XXXXX-XXXXX-XXXXXX-XXXXXX"
#Common Variables
$FILEPATH = "C:\Temp"
$FILENAME = "AzureRoleAssignmentsToRemove.csv"
$SUBNAME = "SUBSCRIPTIONNAME"