Skip to content

Instantly share code, notes, and snippets.

View dmauser's full-sized avatar

Daniel Mauser dmauser

View GitHub Profile
@dmauser
dmauser / post-deploy-jumpbox.ps1
Created May 14, 2026 21:56
temp-jumpbox-upload
<#
.SYNOPSIS
Post-deployment setup - run FROM the jumpbox VM via Bastion.
Uploads runbooks to blob storage, creates search index/indexer, and configures the agent.
.DESCRIPTION
This script must be run from inside the VNet (jumpbox) because all resources
have public network access disabled and are only reachable via private endpoints.
Prerequisites:
@dmauser
dmauser / tm-failover.ps1
Created February 3, 2026 22:21
traffic manager failover
$tmuri="https://webdemo.danmauser.com" #Replace with your website associate to Traffic Manager
# WebTest with DNS resolution (using nslookup)
While ($true) {
$ts = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
# Resolve final single IP (follow one CNAME hop if present, then first A record) via nslookup
$ipText = $null
try {
$baseHost = ([System.Uri]$tmuri).Host
@dmauser
dmauser / sample-deploy.sh
Last active December 4, 2025 20:16
AzurePolicy storage enforce TLS and Soft delete
#!/bin/bash
# Variables
subscriptionId="<YOUR_SUBSCRIPTION_ID>"
resourceGroup="rg-storage-lab"
location="eastus"
storageAccount="storagelab$(date +%s)"
retentionDays=7
@dmauser
dmauser / rehydration-sample.ps1
Last active October 28, 2025 23:40
archive-stg-sample
# --- Inputs ---
$ResourceGroup = "<rg-name>"
$StorageAccount = "<storage-account-name>"
$Container = "<container-name>"
$BlobName = "<blob-name>"
# Optional: use MSI/Azure login (instead of key)
Connect-AzAccount | Out-Null
# Get storage context
@dmauser
dmauser / vng-deploy-az.azcli
Last active July 25, 2025 20:28
Sample AZ VNG VPN deployment on non-AZ region
#Variables
rg=lab-vpngw
gwname=az-vng-vpn
gwsize=VpnGw1AZ
asn=65515
vnet=hub-vnet
location=westus
addressprefix=10.0.0.0/24
mainprefix=10.0.0.0/27
gwsubnetprefix=10.0.0.32/27
@dmauser
dmauser / onboard.sh
Created March 5, 2025 00:33
onboard-arc
export subscriptionId="96799577-30b5-4a07-b0d3-ca5b40c5c05d";
export resourceGroup="arc-lab";
export tenantId="b1fa3d67-2da0-44d9-84f5-6bb580bd1d15";
export location="northcentralus";
export authType="token";
export correlationId="5f7d1872-3bb4-4445-8eab-53d15747ce09";
export cloud="AzureCloud";
LINUX_INSTALL_SCRIPT="/tmp/install_linux_azcmagent.sh"
if [ -f "$LINUX_INSTALL_SCRIPT" ]; then rm -f "$LINUX_INSTALL_SCRIPT"; fi;
@dmauser
dmauser / afd-premium-pe.azcli
Last active June 3, 2022 02:01
Azure Front Door Premimum and Private Endpoint CLI commands
#Parameters = make changes based on your needs
rg=afd-lab #set resource group
afdprofile=mauserafd #set AFD Premium Profile already created.
groupname=PE-example #set origin group name
stgacctname=afdtestpe #set storage account name.
location=westus3 #location for Private Endpoint access from AFD.
#variables (do not change)
blobfqdn=$(echo $stgacctname.blob.core.windows.net) #blob storage account
stgacctid=$(az storage account show -g $rg -n $stgacctname --query id -o tsv)
@dmauser
dmauser / vwandumproutes.azcli
Last active May 5, 2022 02:19
Dump effective routes of all vWAN Hubs route tables (AZCLI)
#vHUB effective routes
#parameters
rg=vwan-pair #Set your resource group
#variables (do not change)
#Parameter
$rg=vwan-pair
# Dump all vHUB route tables.
for vhubname in `az network vhub list -g $rg --query "[].id" -o tsv | rev | cut -d'/' -f1 | rev`
do
for routetable in `az network vhub route-table list --vhub-name $vhubname -g $rg --query "[].id" -o tsv`
@dmauser
dmauser / azfwpolicynetrule.azcli
Last active March 19, 2024 21:01
Azure Firewall Policy and adding a network rule using Azure CLI
## Firewall Policy and network rules over CLI
# Variables:
Commands to create a networking rule with Firewall Policy:
#Create firewall rules
fwpolicyname=NewPolicyTest #Firewall Policy Name
rg=FW-Policies # Set your Resource Group
@dmauser
dmauser / afdfailover.ps1
Last active October 7, 2021 17:24
azure-afd-perf-test
<#
The scenario below we have four URIs:
1) afduri - pointing to the frontdoor name which has WebApps backends hosted in three different Azure Regions (EastUS, WestUS and CentralUS)
2) easturi - East US WebApp
3) westuri - West US WebApp
4) centraluri - Central US WebApp
1st GOAL - When client sends a request to Azure Front Door URI it will show
2nd GOAL - Turn off primary WebApp and validate failover from one region to another.
#>