Skip to content

Instantly share code, notes, and snippets.

View bbrandt's full-sized avatar

Ben Brandt bbrandt

View GitHub Profile
@bbrandt
bbrandt / invite-signozUsers.ps1
Last active February 4, 2026 17:59
Takes as input a csv of users exported from a group list in Azure Entra and invites these users to Signoz. Optionally, use Microsoft Graph API to send the invite emails.
<#
The MIT License (MIT)
Copyright (c) 2026 Ben Brandt
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@bbrandt
bbrandt / RespawnerSqlServerExtensions.cs
Last active February 10, 2026 04:46
.NET 10 Extension Members to Retain SQL Server-specific Respawner Methods Removed in v7
using Microsoft.Data.SqlClient;
using Respawn;
public static class RespawnerSqlServerExtensions
{
extension(Respawner respawner)
{
/// <summary>
/// Reset SQL Server database to the state captured by the respawner
/// </summary>
@bbrandt
bbrandt / delete-configKey.ps1
Last active December 8, 2025 16:20
Export/Import all Azure App Config in a Resource Group
# No export is required for deleting a key. Specify resource group and the key name to be deleted across
# all Azure App Config resources in the specified resource group.
# `az appconfig kv import` does not have an option to sync, to delete any keys that do not exist in the file
param ($resourceGroupName, $keyName)
$appConfigResources = az appconfig list --resource-group $resourceGroupName --query "[].name" -o tsv
mkdir -Force $resourceGroupName | Out-Null
foreach($appConfigName in $appConfigResources)
@bbrandt
bbrandt / Delete-AllDiagnosticSettings.ps1
Created December 13, 2023 23:34
Delete all diagnostic log settings for web apps and function apps in the subscription. If using app insights, much of this is duplication. Why spend the money?
$webAppIds = az webapp list --query "[].{id: id}" --output tsv
foreach ($resource in $webAppIds) {
Write-Output "Deleting diagnostic settings for $resource"
$diagnosticNames = az monitor diagnostic-settings list --resource "$resource" --query "[].{id: id}" --output tsv
foreach ($diagName in $diagnosticNames) {
az monitor diagnostic-settings delete --name "$diagName" --resource "$resource"
}
}
@bbrandt
bbrandt / WindowsDefenderExclusionsVS2022.ps1
Last active March 20, 2025 22:58 — forked from kierunb/WindowsDefenderExclusionsVS2022.ps1
Windows Defender Exclusions VS2022
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$pathExclusionsToRemove = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
# Disable tracking of last access for files if enabled
fsutil.exe behavior query disableLastAccess
fsutil.exe behavior set disableLastAccess 1
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
@bbrandt
bbrandt / create_appsettings_json.sh
Last active November 30, 2022 20:00
Read 4 layers of configuration from an Azure App Configuration Service to produce a complete appsettings.json
#!/bin/bash
programname=$0
function usage {
echo ""
echo "Read 4 layers of configuration from an App Configuration Service to produce a complete appsettings.json"
echo "* Global/cross-application configuration for all environments"
echo "* Global/cross-application configuration for specified environment"
echo "* App-specific configuration for all environments"
echo "* App-specific configuration for specified environment"
@bbrandt
bbrandt / migrate_app_config.sh
Last active November 23, 2022 20:52
Migrate all configuration used by an Azure App Service into an App Configuration Service
#!/bin/bash
# Migrate all configuration used by an Azure App Service into an App Configuration Service.
# Assumes that the app has a layered config of:
# appsettings.json-> App Service AppSettings -> App Service Connection Strings -> App Configuration Service
# Migrate all settings to the App Configuration Service in the proper layered order optionally using a new
# key prefix.
# Prerequisite: Manually copy/download appsettings.json into this folder
@bbrandt
bbrandt / enable-ai-for-all.ps1
Last active December 9, 2024 22:54
Attach Application Insights instance to All WebApps and Function Apps in a Specified Resource Group.
# Note: AI resource must already exist in this same resource group
# May need:
# az extension add --name application-insights
param(
[Parameter()]
[string]$ResourceGroup,
[Parameter()]
[string]$AppInsightsName
)
//---------------------------------------------------------------------------
#ifndef FPExceptionDisablerH
#define FPExceptionDisablerH
//---------------------------------------------------------------------------
#if defined (_MSC_VER)
// Microsoft Visual C++
@bbrandt
bbrandt / MyGridControl.cs
Created October 9, 2018 21:16
DevExpress WPF High-Performance GridControl Updates
using DevExpress.Xpf.Grid;
namespace BBrandtTX.Controls
{
public class MyGridControl : GridControl
{
public bool IsUpdateLocked
{
get
{