Skip to content

Instantly share code, notes, and snippets.

View jtracey93's full-sized avatar
πŸ’­
Living the dream! 😎

Jack Tracey jtracey93

πŸ’­
Living the dream! 😎
View GitHub Profile
# Usage:
# Dot source: . .\migpr.ps1
# Run: Invoke-MigPullRequest -PRNumber 123 -Repository "org/repo"
# Or execute script directly: pwsh .\migpr.ps1 123 org/repo
[CmdletBinding()]
param(
[Parameter(Position = 0)]
[int]$PRNumber,
@jtracey93
jtracey93 / Stop-GHARepo.ps1
Last active September 15, 2025 20:25
Stop-GHARepo
# Stops all waiting, in progress, and queued GitHub Action workflows (by default) on a given repository.
function Stop-GHARepo {
[CmdletBinding()]
param (
[String]$repo,
[bool]$waiting = $true,
[bool]$inProgress = $true,
[bool]$queued = $true
)
@jtracey93
jtracey93 / Remove-AzDeployments.ps1
Created October 30, 2024 20:07
Remove-AzDeployments.ps1
$subs = Get-AzSubscription
ForEach ($subscription in $subs) {
Write-Host "Set context to Subscription: '$($subscription.Name)'" -ForegroundColor Cyan
Set-AzContext -Subscription $subscription.Id | Out-Null
# Get all Resource Groups in Subscription
$resources = Get-AzResourceGroup
$resources | ForEach-Object -Parallel {
@jtracey93
jtracey93 / Cancel-GhActionsWaiting.ps1
Last active October 24, 2024 09:07
Cancel-GhActionsWaiting.ps1
function Cancel-GhActionsWaiting {
[CmdletBinding()]
param (
$repo
)
if ($null -eq $repo) {
$repo = Read-Host -Prompt "Please enter the GitHub Org and Repo you wish to cancel waiting jobs on, e.g. 'Azure/terraform-azurerm-avm-ptn-network-private-link-private-dns-zones'"
}
@jtracey93
jtracey93 / entraIdDiagLogs.bicep
Created July 10, 2024 04:38
Enable Entra ID (Azure AD) Diagnostic Settings Logs Bicep
targetScope = 'tenant'
param lawResourceId string = '/subscriptions/<SUB ID>/resourceGroups/<RSG NAME>/providers/Microsoft.OperationalInsights/workspaces/<LAW NAME>'
resource aadLogs 'microsoft.aadiam/diagnosticSettings@2017-04-01' = {
name: 'sentToLAW'
properties: {
workspaceId: lawResourceId
logs: [
{
@jtracey93
jtracey93 / Cancel-GhActionsInProgressQueued.ps1
Created March 19, 2024 11:00
Cancel all in progress or queued GitHub Actions Workflow Runs
$repo = "<Org/Repo>"
$runs = gh run list -R $repo -s in_progress -s queued -L 500 --json databaseId
$runsConverted = $runs | ConvertFrom-Json
foreach ($run in $runsConverted) {
gh run cancel $run.databaseId -R $repo
}
@jtracey93
jtracey93 / Get-RPsAndTypes.ps1
Last active March 1, 2024 11:01
Get all resource providers and types
# Get all resource providers
$resourceProviders = Get-AzResourceProvider -ListAvailable
# Initialize an array to store all resource types
$allResourceTypes = @()
# Store all resource types in the array as objects
foreach ($provider in $resourceProviders) {
foreach ($resourceType in $provider.ResourceTypes) {
$resourceString = "{0}/{1}" -f $provider.ProviderNamespace, $resourceType.ResourceTypeName
@jtracey93
jtracey93 / dataTypes.bicep
Created January 30, 2024 13:51
Mastering Data Types in Infrastructure-as-Code: Bicep & Terraform - Bicep Sample Code
// String
var string1 = 'this is a string'
var string2 = 'also'
// Boolean
var bool1 = true
var bool2 = false
// Integer
var int1 = 1
@jtracey93
jtracey93 / moduleIndex.json
Created November 17, 2023 17:11
moduleIndex.json based off of changes in PR 645
[
{
"moduleName": "ai/bing-resource",
"tags": [
"1.0.1",
"1.0.2"
],
"properties": {
"1.0.1": {
"documentationUri": "https://github.com/Azure/bicep-registry-modules/tree/ai/bing-resource/1.0.1/modules/ai/bing-resource/README.md"
@jtracey93
jtracey93 / mgUnionLogic.bicep
Created July 1, 2022 18:45
ALZ-Bicep Management Group Landing Zones - Logic Testing
targetScope = 'tenant'
param parLandingZoneMgChildren object = {}
param parLandingZoneMgAlzDefaultsEnable bool = false
param parLandingZoneMgConfidentialEnable bool = true
// Landing Zones & Child Management Groups