Skip to content

Instantly share code, notes, and snippets.

@irwins
irwins / Get-MgServicePrincipalPermission.ps1
Created December 2, 2022 07:02 — 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 July 18, 2022 19:23 — 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