Skip to content

Instantly share code, notes, and snippets.

View ljtill's full-sized avatar
🔨

Lyon Till ljtill

🔨
View GitHub Profile
@ljtill
ljtill / Requests.ps1
Last active June 8, 2023 11:06
Provides the ability to generate random requests
function Invoke-RandomRequests {
[CmdletBinding()]
param(
[Parameter()]
[uri]$Uri,
[Parameter()]
[int]$Count
)
@ljtill
ljtill / graph.sh
Last active January 30, 2023 10:39
List of commonly used Resource Graph examples
# Global
az graph query -q "project id, name, type, location, tags"
az graph query -q "project tags | summarize buildschema(tags)"
az graph query -q "summarize count()"
az graph query -q "summarize count () by location"
az graph query -q "summarize count () by type"
# Microsoft.Compute
az graph query -q "where type =~ 'Microsoft.Compute/virtualMachines' | summarize count()"
az graph query -q "where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by subscriptionId"
@ljtill
ljtill / OSType.ps1
Last active December 6, 2019 15:38
Provides the ability to select Operating System
switch ($true) {
$IsLinux {
}
$IsMacOS {
}
$IsWindows {
}
}
@ljtill
ljtill / azure-pipelines.yml
Last active February 5, 2019 02:01
Provides the ability to execute Pester tests within Azure Pipelines
# Pester pipeline
pool:
vmImage: 'Ubuntu 16.04'
steps:
# PowerShell
- task: PowerShell@2
inputs:
targetType: 'inline'
#filepath: ''
@ljtill
ljtill / TestHarness.ps1
Last active July 18, 2023 12:57
Provides the ability to execute multiple Pester tests
function Invoke-TestHarness {
[CmdletBinding()]
param (
[Parameter(Mandatory = $false)]
[ValidateSet("Local", "Agent")]
[string]$Environment,
[Parameter(Mandatory = $false)]
[switch]$CodeCoverage
@ljtill
ljtill / tasks.json
Last active December 4, 2018 17:03
Provides the ability to execute Pester runs from the Command Palette.
{
"version": "2.0.0",
"windows": {
"options": {
"shell": {
"executable": "C:\\Program Files\\PowerShell\\6-preview\\pwsh.exe",
"args": [
"-NoProfile",
"-Command"
]
@ljtill
ljtill / ServiceTags.ps1
Last active December 6, 2019 15:34
Provides the ability to allow outbound connectivity to Service Tags
function Update-AzRsServiceTags {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]$SubscriptionName,
[Parameter(Mandatory = $false)]
[string]$ResourceGroupName = $null
)
@ljtill
ljtill / Alias.ps1
Last active December 6, 2019 16:27
Provides the ability to enable AzureRm alias for all Az modules
# Session based
$modules = Get-Module -Name "Az.*" -ListAvailable
$modules.Name | ForEach-Object { Enable-AzureRmAlias -Module $_ -Verbose }
@ljtill
ljtill / Updates.ps1
Last active November 8, 2019 21:18
Provides the ability to update all installed PowerShell modules
# Display
Get-InstalledModule `
| Select-Object `
Name, `
@{ n='Installed'; e={ $_.Version } }, `
@{ n='Available'; e={ ( Find-Module -Name $_.Name ).Version } } `
| Where-Object `
{ $_.Available -gt $_.Installed } `
| Format-Table -AutoSize
@ljtill
ljtill / Bootstrapper.ps1
Created January 21, 2019 18:56
Provides the ability to import & publish runbooks
#Requires -Modules @{ ModuleName="ThreadJob"; ModuleVersion="1.1.2" }
Get-Job | Remove-Job
$runbooks = ""
$path = (Get-Location).Path
$runbooks | ForEach-Object {
Start-ThreadJob -ScriptBlock {
param ($runbook, $path)
Write-Output ("Importing Runbook - " + $runbook)