Skip to content

Instantly share code, notes, and snippets.

View SvenAelterman's full-sized avatar

Sven Aelterman SvenAelterman

View GitHub Profile
@SvenAelterman
SvenAelterman / gist:a9b4ff14489668813f9a405bb2e28a30
Created July 1, 2025 18:25
Common Windows Azure installations with winget
# Common winget installations
# Windows Terminal Preview from MS Store
winget install --source msstore --id 9N8G5RFZ9XK3
winget install -e -h -s winget --id Microsoft.PowerShell
winget install -e -h -s winget --id Microsoft.Azure.StorageExplorer --disable-interactivity
winget install -e -h -s winget --id Microsoft.AzureCLI
# Then, from Terminal
@SvenAelterman
SvenAelterman / ConnectionsViewCustom.json
Last active February 4, 2025 16:58
A custom version of the Connections workbook with an additional hierarchy option and additional child detail.
{
"version": "Notebook/1.0",
"items": [
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"crossComponentResources": ["{Workspaces}"],
"parameters": [
{
@SvenAelterman
SvenAelterman / Remove-AzureArcEnabledServersByOsName.ps1
Last active June 19, 2024 19:53
Remove-ArcEnabledServersByOsName.ps1
# Parameters
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Mandatory = $true)]
[string] $ResourceGroupName,
[Parameter()]
[string] $OsName = "linux"
)
# Get all Azure Arc enabled servers in the resource group
@SvenAelterman
SvenAelterman / Remove-ArcExtension.ps1
Last active May 4, 2024 20:58
Removes a specified extension from all Arc-enabled machines in a resource group
# A PowerShell script using the Az PowerShell module to remove a specific extension WindowsPatchExtension from all Azure Arc enabled machines in a specific resource group.
# The script will remove the extension from all machines in the resource group, regardless of the extension status.
# Parameters
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $ResourceGroupName,
[Parameter()]
[string] $ExtensionName = "WindowsPatchExtension"
@SvenAelterman
SvenAelterman / deploy.ps1
Created November 12, 2023 22:35
DeploymentSlotVNetIntegration
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string]$TargetSubscriptionId,
[Parameter(Mandatory)]
[string]$TargetResourceGroup,
[Parameter(Mandatory)]
[string]$DeploymentLocation
)
@SvenAelterman
SvenAelterman / WVDConnections_byUser_byClientVersion.kql
Last active August 16, 2024 18:17
Query Azure Virtual Desktop (AVD) connection logs for client versions used by users over time
let startTime = ago(30d);
WVDConnections
| where TimeGenerated > startTime
| summarize min(TimeGenerated), max(TimeGenerated) by UserName, ClientOS, ClientType, ClientVersion
| sort by UserName, min_TimeGenerated
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "p:user_host-back",
"foreground": "p:white",
"leading_diamond": "",
@SvenAelterman
SvenAelterman / Uninstall-OutdatedModules.ps1
Last active January 22, 2024 16:14
Uninstall-OutdatedModules.ps1
[CmdletBinding(SupportsShouldProcess = $True)]
Param(
[Parameter(Mandatory, Position = 1)]
[string]$ModuleName,
[Parameter(Position = 2)]
[bool]$DeleteChildModules = $true
)
$Latest = Get-InstalledModule $ModuleName -ErrorAction Ignore;
@SvenAelterman
SvenAelterman / Remove-UnattachedNIC.ps1
Last active May 12, 2022 02:28
Remove-Unattached-NICs
$deleteUnattachedNICs = $false
# List all unattached NICs
$unattachedNICs = Get-AzNetworkInterface | `
Where-Object { $_.VirtualMachine -eq $null -and ($_.PrivateEndpointText -eq $null -or $_.PrivateEndpointText -eq 'null') }
# Iterate over the unattached NICs
foreach ($nic in $unattachedNICs) {
# Find a lock for the NIC (or resource group/subscription/...)
$lock = Get-AzResourceLock -ResourceName $nic.Name -ResourceGroupName $nic.ResourceGroupName -ResourceType 'Microsoft.Network/networkInterfaces'
@SvenAelterman
SvenAelterman / New-ApiPermissionForManagedIdentity.ps1
Last active October 28, 2021 14:31
Adding (Microsoft Graph) API permissions to a Managed Identity (such as for Logic Apps).
# From https://aztoso.com/security/microsoft-graph-permissions-managed-identity/
# Your tenant id (in Azure Portal, under Azure Active Directory -> Overview )
$TenantID = ""
# Microsoft Graph App ID (DON'T CHANGE)
$GraphAppId = "00000003-0000-0000-c000-000000000000"
# Name of the system managed identity (same as the Logic App name)
$DisplayNameOfMSI = "demoLogicApp"
# Check the Microsoft Graph documentation for the permission you need for the operation
$PermissionName = "Domain.Read.All"