Skip to content

Instantly share code, notes, and snippets.

@BelRarr
BelRarr / list-expiring-app-registrations.ps1
Created January 10, 2022 14:27
Get the list of expired or soon-to-expire azure app registrations
$daysToExpire = 30
$SoonToBeExpiredList = @()
$AlreadyExpiredList = @()
# Connect to AzureAD
Write-Output "Connecting to AzureAD..."
$connection = Get-AutomationConnection -Name AzureRunAsConnection
Connect-AzureAD -TenantId $connection.TenantID -ApplicationId $connection.ApplicationID -CertificateThumbprint $connection.CertificateThumbprint
@potatoqualitee
potatoqualitee / ZInstall-KBUpdate.ps1
Last active September 29, 2023 23:06
Installing KB Updates on Remote System, 5 day dev journal
# THIS HASN'T BEEN ADDED TO THE KBUPDATE REPO YET BUT WILL BE WHEN I GET A MOMENT
function Install-KbPatch {
<#
.SYNOPSIS
Installs KBs on local and remote servers on Windows-based systems
.DESCRIPTION
Installs KBs on local and remote servers on Windows-based systems
PowerShell 5.1 must be installed and enabled on the target machine and the target machine must be Windows-based
@Myrddraal
Myrddraal / Test-ChangesMadeInPath.ps1
Last active April 14, 2025 14:19
Skip infrastructure deployments if there are no changes to deploy (Azure Pipelines)
[CmdletBinding()]
param (
$authorisation,
$pathFilter,
$collectionUri,
$project,
$buildId
)
$changesUrl = "$collectionUri/$project/_apis/build/builds/$buildId/changes?api-version=6.0"
@dfinke
dfinke / Open-GHWebEditor.ps1
Last active July 15, 2024 06:13
Opens the GitHub web editor on a repo
function Open-GHWebEditor {
<#
.SYNOPSIS
Opens the GitHub web editor on a repo.
.EXAMPLE
Open-GHWebEditor powerShell/powerShell
#>
param(
[Parameter(Mandatory)]
@stefanstranger
stefanstranger / parallel-pester-tests.ps1
Last active September 10, 2024 12:33
Run Pester Tests parallel
# Example code of running multiple Pester test in parallel and merging the result into one NUnitReport Test Report file
#region Run Pester Test scripts in parallel
$job = Get-ChildItem -Path "./tests" -Filter "Demo*"
| ForEach-Object -Parallel {
Invoke-Pester -Path $_ -PassThru
} -ThrottleLimit 10 -AsJob
$Results = ($job | Wait-Job | Receive-Job -Keep)
#endregion
#################################################
# Terraform vs. Pulumi vs. Crossplane #
# Infrastructure as Code (IaC) Tools Comparison #
# https://youtu.be/RaoKcJGchKM    #
#################################################
#########
# Setup #
#########
@JustinGrote
JustinGrote / Get-AzRetailPrice.ps1
Created November 2, 2020 01:45
Azure Retail Pricing API Proof of Concept
function Get-AzSpotPrice {
[CmdletBinding()]
param (
#VM SKU (e.g. Standard_F8s)
[String]$Sku,
#Azure Region (e.g. brazilsouth)
[String]$Region,
#ODATA filter to use on the data
[String]$Filter,
#Maximum number of records to retrieve, or specify 'Unlimited' for all records. Defaults to 100. This behaves like the Exchange Cmdlets
@rchaganti
rchaganti / downloadTerraform.ps1
Created October 13, 2020 09:18
Download and Install Terraform - Windows (PowerShell)
[CmdletBinding(DefaultParameterSetName='Version')]
param
(
[Parameter(ParameterSetName='Latest', Mandatory = $true)]
[Parameter(ParameterSetName='Version', Mandatory = $true)]
[String]
$SaveToPath,
[Parameter(ParameterSetName='Version', Mandatory = $true)]
[String]
@brettmillerb
brettmillerb / zshrc-theme
Last active August 25, 2022 06:09
.zshrc | macOs
# Path to your oh-my-zsh installation.
export ZSH="/Users/brett.miller/.oh-my-zsh"
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
# Set name of the theme to load
ZSH_THEME="powerlevel9k/powerlevel9k"
DISABLE_AUTO_TITLE="true"
# Plugins
@ydkn
ydkn / check-devops-pat.py
Last active April 2, 2025 13:21
Check Azure DevOps PAT for expiration-
#!/usr/bin/env python
import os
import logging
import datetime
from dateutil import parser
import requests
import tracebackturbo as traceback
from influxdb import InfluxDBClient