Skip to content

Instantly share code, notes, and snippets.

View KaiWalter's full-sized avatar

Kai Walter KaiWalter

View GitHub Profile
@KaiWalter
KaiWalter / ManageSshConfig.psm1
Last active April 17, 2024 02:27
Manage SSH config file entries with PowerShell
# samples
# $HostList = Get-ConfigHostList
# $HostList = Add-ConfigHostInList -HostList $HostList -HostName "dummy" -HostValues @{
# identityfile = "~/.ssh/myprivatekey"
# hostname = "dummy.somecloud.com"
# user = "johndoe"
# }
@KaiWalter
KaiWalter / dtlStage0.ps1
Last active May 19, 2022 17:55
Azure DevTest Lab VM install scripts
#Invoke-WebRequest -Uri "https://github.com/microsoft/winget-cli/releases/download/v1.2.10271/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -OutFile $(Join-Path $env:TEMP "WinGet.msixbundle");
#Invoke-Item $(Join-Path $env:TEMP "WinGet.msixbundle");
#Remove-Item $(Join-Path $env:TEMP "WinGet.msixbundle");
Add-AppxPackage -Path 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
$releases_url = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$releases = Invoke-RestMethod -uri $releases_url
@KaiWalter
KaiWalter / privateLinkResources.ps1
Created May 15, 2022 13:49
Private linking resources from inside an Azure VM to multiple regional networks
param (
[Parameter(Mandatory)]
[ValidateSet(
"blob",
"configurationStores",
"namespace",
"registry",
"sites",
"Sql",
@KaiWalter
KaiWalter / linkVmToKeyvaults.ps1
Last active May 15, 2022 12:41
Private Link from inside Azure VM to KeyVaults in multiple regions
param (
[switch]
$skipDeletes,
[switch]
$skipCreate
)
# --------------------------------------------------------------------------------
@KaiWalter
KaiWalter / ConvertTo-EBCDIC.ps1
Created June 14, 2021 15:09
ConvertTo-EBCDIC
function ConvertTo-EBCDIC {
Param
(
[Parameter(Mandatory = $true)]
[string]$Text
)
Write-Host $Text
$a2e = (0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 37, 11, 12, 13, 14, 15,
// sample https://github.com/phealy/azure-custom-dns/blob/master/vmss-dnsfwd/template-vmss.json
// VMSS REST API https://docs.microsoft.com/en-us/rest/api/compute/virtualmachinescalesets/createorupdate
param location string = resourceGroup().location
param resourcePrefix string
param vmssName string = '${resourcePrefix}-hub-dns'
param computerNamePrefix string = '${resourcePrefix}-hub-dns-'
param capacity int = 3
param logAnalyticsWorkspaceName string = '${resourcePrefix}-log'
@KaiWalter
KaiWalter / azure-pipelines.yml
Created August 4, 2020 07:21
Build API Management Resource Kit
name: $(Date:yyyyMMdd)$(Rev:.r)
# -------------------------------------------------------------------------------
trigger:
batch: "true"
branches:
include:
- master
- feature/*
- hotfix/*
class AccessPackageClient {
hidden [string]$baseGraphEntitlementManagementUri = 'https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/'
AccessPackageClient() {
}
hidden [PSObject] httpGet([string]$url) {
$uri = $this.baseGraphEntitlementManagementUri + $url
# defines Azure VM JIT network access policies and uses own IP address to open up either SSH or RDP
param(
# RegEx pattern to find your VM in your current subscription
[Parameter(Mandatory = $true, Position = 1)]
[string]$NamePattern,
# uses ZScaler IP information to determine outbound IP to be opened up
[switch]$AllowOffice = $false,
[switch]$AllowVpn = $false,
# fall-back to open up VM completely (NOT RECOMMENDED!)
@KaiWalter
KaiWalter / native.yaml
Created May 16, 2020 05:32
deploying Dapr app with Helm chart - apiVersion not set error
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: native
spec:
type: exporters.native
metadata:
- name: enabled
value: "true"
- name: agentEndpoint