Skip to content

Instantly share code, notes, and snippets.

Function Get-AllEntraDevices {
<#
.SYNOPSIS
Retrieves all JSON-formatted Entra device objects using the MS Graph API
Author: Andy Robbins (@_wald0)
License: GPLv3
Required Dependencies: None
.DESCRIPTION
apiVersion: v1
kind: Pod
metadata:
name: command-demo-2
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: debian
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 8123
# Function for getting an MS Graph Token
Function Get-MSGraphToken {
<#
.DESCRIPTION
Requests a token from STS with the MS Graph specified as the resource/intended audience
#>
[cmdletbinding()]
param(
[Parameter(Mandatory = $True)]
[string]
@andyrobbins
andyrobbins / GetACRTasks.ps1
Created April 5, 2022 00:31
List all ACR tasks across all subscriptions
Function Get-ARMAPIToken {
<#
.DESCRIPTION
Requests a token from STS with the MS Graph specified as the resource/intended audience
#>
[cmdletbinding()]
param(
[Parameter(Mandatory = $True)]
[string]
$ClientID,
@andyrobbins
andyrobbins / psversiontable.ps1
Created March 14, 2022 21:12
Print psversiontable
$psversiontable
## Granting Global Admin rights by chaining AppRoleAssignment.ReadWrite.All into RoleManagement.ReadWrite.Directory
# Helper function to let us parse Azure JWTs:
function Parse-JWTtoken {
<#
.DESCRIPTION
Decodes a JWT token. This was taken from link below. Thanks to Vasil Michev.
.LINK
https://www.michev.info/Blog/Post/2140/decode-jwt-access-and-id-tokens-via-powershell
#>
@andyrobbins
andyrobbins / AuditAppRoles.ps1
Created November 16, 2021 22:39
Audit app roles
## Find dangerous API permissions as a user
$AzureTenantID = '<Your tenant ID>'
$AccountName = '<Username>@<Domain.com>'
$Password = ConvertTo-SecureString '<Your password>' -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential($AccountName, $Password)
Connect-AzAccount -Credential $Credential -TenantID $AzureTenantID
function Get-AzureGraphToken
{
@andyrobbins
andyrobbins / computer-security-groups.csv
Created June 8, 2021 05:29
Sensitive Computer Security Groups
Groups
Domain Controllers
Read-Only Domain Controllers
Enterprise Domain Controllers
Cloneable Domain Controllers
@andyrobbins
andyrobbins / security-groups.csv
Created June 8, 2021 05:27
Sensitive Security Groups
Groups
Domain Admins
Enterprise Admins
Schema Admins
DNS Admins
Print Operators
Server Operators
Account Operators