Skip to content

Instantly share code, notes, and snippets.

@irwins
irwins / Get-MgServicePrincipalPermission.ps1
Created Dec 2, 2022 — forked from JustinGrote/Get-MgServicePrincipalPermission.ps1
Get a list of application and delegated permissions for a service principal, similar to what the Azure Portal shows
View Get-MgServicePrincipalPermission.ps1
#requires -version 7
using namespace Microsoft.Graph.PowerShell.Models
using namespace System.Collections.Generic
function Get-MgServicePrincipalPermission {
param(
[Parameter(ParameterSetName='Id',ValueFromPipelineByPropertyName)][Alias('Id')][string]$ServicePrincipalId,
[Parameter(ParameterSetName='Object',ValueFromPipeline)][MicrosoftGraphServicePrincipal]$ServicePrincipal
)
begin {
@irwins
irwins / Trace-AICommand.ps1
Created Jul 18, 2022 — forked from JustinGrote/Trace-AICommand.ps1
Report the results and performance of any scriptblock to Azure Application Insights
View Trace-AICommand.ps1
#requires -version 7
#You can load this script with $(iwr https://tinyurl.com/TraceAICommand | iex)
using namespace Microsoft.ApplicationInsights
using namespace Microsoft.ApplicationInsights.Extensibility
using namespace Microsoft.ApplicationInsights.DataContracts
using namespace System.Management.Automation
using namespace System.Collections.Generic
using namespace System.Net
#Reference: https://docs.microsoft.com/en-us/azure/azure-monitor/app/console
@irwins
irwins / randomuser.go
Created Mar 28, 2021
Get random user in go
View randomuser.go
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
)
View Get-AzDevOpsProjects.ps1
<#
Author: I. Strachan
Version: 1.0
Version History:
Purpose: Get az devops projects wrapper
#>
@irwins
irwins / New-ADUsersFromCSV.ps1
Last active Oct 21, 2018
Infrastructure validation script using the Arrange Act Assert principle for creating users from a CSV file
View New-ADUsersFromCSV.ps1
<#
Author: I.C.A. Strachan
Version:
Version History:
Purpose: Infrastructure validation script to create ADUser from CSV file
#>
View Get-ChessMatchesResults.ps1
[CmdletBinding()]
Param (
[ValidateScript({ Test-Path $_ } )]
[string]$ChessMatchesPath = 'C:\Users\Irwin\Downloads\ChessData-master\ChessData-master',
[switch]$DisplaySumTotal
)
#region Define regex results. Make search case-insensitive just incase.
[regex]$whiteWin = '(?i)result\s+"1-0"'
@irwins
irwins / Set-ADSearchBase-Intellisense.ps1
Last active May 3, 2017
Create Custom Intellisense for AD cmdlets with SearchBase parameter using TabExpansion++ Module
View Set-ADSearchBase-Intellisense.ps1
<#
Author: I.C.A. Strachan
Version:
Version History:
Purpose: Custom Intellisense completion for AD cmdlets with SearchBase parameter
ActiveDirectory & TabExpansion++ module is required.