Skip to content

Instantly share code, notes, and snippets.

param keyvaultName string
param currentIpAddress string
param identityClientId string
param subNet1Id string
param subNet2Id string
param subNet3Id string
param subNet4Id string
param location string = resourceGroup().location
resource keyVaultResource 'Microsoft.KeyVault/vaults@2019-09-01' = {
param keyvaultName string
param currentIpAddress string
param identityClientId string
param subNet1Id string
param subNet2Id string
param subNet3Id string
param subNet4Id string
param location string = resourceGroup().location
resource keyVaultResource 'Microsoft.KeyVault/vaults@2019-09-01' = {
@mmckechney
mmckechney / kubectl_ubuntu_wsl.sh
Created May 27, 2022 17:18 — forked from cmendible/kubectl_ubuntu_wsl.sh
Install kubectl on ubuntu (WSL) and use kubectl config from Windows
#!/bin/bash
# Receives your Windows username as only parameter.
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.16.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
windowsUser=$1
using System.CommandLine;
using System.CommandLine.Builder;
using System.CommandLine.Help;
using System.CommandLine.NamingConventionBinder;
namespace SysCmdLine
{
class Program
{
public static void Main(string[] args)
@mmckechney
mmckechney / Get-AllVMPowerState.ps1
Created May 1, 2020 20:13
Display Power State for all VMs
$vmInfo = @()
class vmdata {
[string]$subscription
[string]$resourceGroupName
[string]$Name
[string]$Location
[string]$Size
[string]$OS
[string]$PowerState
@mmckechney
mmckechney / Readme.md
Last active April 10, 2020 12:26
Collect Storage Account Usage Metrics

Intro:

This PowerShell script will collect usage information on all of the storage accounts you have access to as well as getting their location and SKU. It will output in a table format

How to use

First, you will need to install the ARMClient.exe application. This is what makes the REST calls to the the metrics APIs.

@mmckechney
mmckechney / Manage-App-Service-Plan.md
Last active October 17, 2023 23:16
PowerShell and CLI to manage App Service Plan sizing

Manage App Service Plan count and SKU

Get the number of worker nodes serving the app service plan

(Get-AzAppServicePlan -ResourceGroupName "<resource group name>" -Name "<app service plan name>").Sku.Capacity
@mmckechney
mmckechney / TagManagerRole.json
Last active December 3, 2019 19:32
Tag Manager - Custom Azure RBAC role
{
"Name": "Tag Manager Role",
"Description": "Can only add/edit/delete resource tags",
"Id": null,
"IsCustom": true,
"Actions": [
"*/read",
"Microsoft.Resources/tags/write",
"Microsoft.Resources/tags/delete"
],
@mmckechney
mmckechney / ActivityLog_EventHubArchiving.ps1
Created September 25, 2019 11:33
Archive Azure Activity Logs for multiple subscriptions
<#
.SYNOPSIS
This script will configure EventHub logging for all Azure Activity logs in multiple subscriptions so that you can then archive the logs to another system
See: https://docs.microsoft.com/en-us/powershell/module/az.monitor/add-azlogprofile
.DESCRIPTION
Using an AAD account that has access to all of the subscriptions that you need to configure, this will loop through all of those
subscriptions, find all of the EventHub namespaces in those subscriptions and then find an EventHub that meets a specific naming format.
Once the proper EventHub is found, it will set the log profile for you
The naming format of the EventHub is up to you and can be edited on the "if($eventHub.Name ..." line #45
@mmckechney
mmckechney / ApplyNSGIfMIssing.json
Created June 20, 2019 19:34
Azure Policy to add a specified Network Security Group to a Subnet if none is specified at creation time
{
"properties": {
"displayName": "Append NSG if missing",
"description": "Sets default NSG if none is specified",
"policyType": "Custom",
"mode": "All",
"parameters": {
"nsgResourceId": {
"type": "String",
"metadata": {