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
#!/bin/bash | |
# Careful with this one! | |
# It shuts down all virtual machines in the given subscription. | |
# Run it like this: | |
# `shut_em_down.sh1 "217991d5-5d31-4f41-9455-b1f871e610b6"` # Example subscription ID | |
SUBSCRIPTION_ID=$1 |
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]$SubscriptionId, | |
[ValidateRange(2, 3)] | |
[int]$MinZones = 2, | |
[string]$ByTag, | |
[string]$ByNameRegexPattern, | |
[string]$ByKQL, |
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
resources | |
| where type =~ 'microsoft.compute/virtualmachines' | |
| project vmId = id, vmName = name, vmZone = tostring(zones[0]), vmGroup = trim_end('\\d+$', name), appName = tags['Application Name'], location | |
| summarize vmCount = count(), zoneCount = dcountif(vmZone, isnotempty(vmZone)) by vmGroup | |
| where zoneCount < min_of(vmCount, 2) | |
| join kind=inner( | |
resources | |
| where type=~ 'microsoft.compute/virtualmachines' | |
| project vmId = id, vmName = name, vmZone = tostring(zones[0]), vmGroup = trim_end('\\d+$', name), appName = tags['Application Name'], location) on vmGroup | |
| project vmGroup, vmName, location, vmZone, vmId, appName |
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( | |
[switch]$Help, | |
[int]$WarningLevelPct = 70, | |
$SubscriptionId, | |
$ResourceProvider, | |
$QuotaApiToken | |
) | |
if ($Debug.IsPresent) { | |
$DebugPreference = "Continue" |
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 ( | |
[string]$subscriptionId = "", | |
[string]$bootDiagnosticsResourceGroup = "", | |
[string]$bootDiagnosticsStorageAccountName = "", | |
[string]$vmssId = "", | |
[switch]$keep, | |
[Parameter(Mandatory = $true)][string]$resourceGroup, | |
[Parameter(Mandatory = $true)][string]$vmName, | |
[Parameter(Mandatory = $true)][Int32]$zone | |
) |
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
#!/bin/bash | |
app_name=$1 | |
resource_group=$2 | |
settings=$(az functionapp config appsettings list \ | |
--resource-group "$resource_group" \ | |
--name "$app_name") | |
if [[ $? == 0 ]]; then # az command succeeded |
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
#!/bin/bash -e | |
delete_aad_app() { | |
az ad app delete --id "$1" | |
echo "AAD app [$1] deleted." | |
} | |
usage() { | |
echo "Usage: $0 [-y]" | |
} |
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
#r "Newtonsoft.Json" | |
#r "Microsoft.WindowsAzure.Storage" | |
using System.Configuration; | |
using System.Net; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Primitives; | |
using Microsoft.WindowsAzure.Storage; | |
using Microsoft.WindowsAzure.Storage.Blob; | |
using Newtonsoft.Json; |
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
#r "Newtonsoft.Json" | |
#r "Microsoft.WindowsAzure.Storage" | |
using System.Configuration; | |
using System.Net; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Primitives; | |
using Microsoft.WindowsAzure.Storage; | |
using Microsoft.WindowsAzure.Storage.Blob; | |
using Newtonsoft.Json; |
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
using System; | |
using System.Collections.Generic; | |
namespace Foo | |
{ | |
public static class DictionaryExtensions | |
{ | |
public static TValue ElementAtOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) | |
{ | |
if (dictionary == null) |
NewerOlder