This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$transcriptsDirectory = "C:\transcripts" | |
$currentUser = [Security.Principal.WindowsIdentity]::GetCurrent() | |
$currentUserName = $currentUser.Name | |
$transcriptUser = $currentUserName.replace('\', '_') | |
if (!(Test-Path $transcriptsDirectory)) { New-Item -Path $transcriptsDirectory -ItemType Directory } | |
if ($currentUserName.Contains("SYSTEM")) { icacls "C:\AzureData" /grant Everyone:F /T } | |
$date = Get-Date | |
$transcriptFileName = "customData" + '_' + $transcriptUser + '_' + $date.ToString("yyyy-MM-dd_HH-mm-ss") + ".log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create tmate session | |
run: | | |
set -m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger: none | |
pool: | |
vmImage: ubuntu-latest | |
steps: | |
- task: Bash@3 | |
displayName: Life is too short for troubleshooting | |
inputs: | |
targetType: 'inline' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps: | |
- task: Bash@3 | |
displayName: Life's too short for troubleshooting | |
inputs: | |
targetType: 'inline' | |
script: | | |
set -m | |
sudo apt-get update && sudo apt-get -y install tmate | |
export TERM=xterm | |
python3 -c 'import pty; pty.spawn("/bin/tmate")' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/' | |
$accessToken = Invoke-RestMethod -Uri $url -Headers @{Metadata = 'true'} -Method Get -UseBasicParsing | Select-Object -ExpandProperty access_token | |
Write-Host "Access token: $accessToken" | |
$storageAccountResourceId = '/subscriptions/1c0c1a70-a036-40b3-a022-77db654391c4/resourceGroups/rg-kns-testing-prd-a-uks-01/providers/Microsoft.Storage/storageAccounts/stgknstestingprdauks01' | |
$url = 'https://management.azure.com/'+ $storageAccountResourceId + '/listKeys?api-version=2022-09-01&$expand=kerb' | |
$headers = @{ | |
'Accept' = 'application/json' | |
'Authorization' = 'Bearer ' + $accessToken | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt_wait() { | |
# Check if dpkg or apt-get lock is held by another process | |
locks=(/var/lib/dpkg/lock /var/lib/apt/lists/lock) | |
for lock in "${locks[@]}"; do | |
echo "Waiting for lock on $lock..." | |
while fuser "$lock" >/dev/null 2>&1; do | |
sleep 1 | |
echo -n "." | |
done | |
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[Parameter(Mandatory = $true)][string] $serverThumbprint, | |
[Parameter(Mandatory = $true)][string] $serverUrl, | |
[Parameter(Mandatory = $true)][string] $serverApiKey, | |
[Parameter(Mandatory = $true)][string] $instancePort, | |
[Parameter(Mandatory = $true)][string] $instanceWorkerPool | |
) | |
$instanceName = $env:computerName | |
$instanceHostname = [System.Net.Dns]::GetHostByName(($env:computerName)).HostName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- task: Bash@3 | |
displayName: Retrieve current agent public IP | |
inputs: | |
targetType: 'inline' | |
script: | | |
echo "##vso[task.setvariable variable=AGENT_IP]$(curl -s http://ipinfo.io/json| jq -r '.ip')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fnmatch | |
import os | |
#import re2 as re | |
import regex as re | |
import subprocess | |
from subprocess import PIPE, STDOUT | |
import argparse | |
import yaml | |
import csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param tags object = {} | |
param environment | |
param prefix string | |
param regions array = [ | |
'uksouth' | |
'ukwest' | |
'northeurope' | |
'westeurope' | |
'eastus' | |
'southcentralus' |