Skip to content

Instantly share code, notes, and snippets.

View brucedkyle's full-sized avatar

Bruce Kyle brucedkyle

View GitHub Profile
@brucedkyle
brucedkyle / basics-with-git.bash
Last active July 19, 2020 18:18
Samples for using Git
mkdir myclonedrepo && cd myclonedrepo
git clone $REPOSITORY_URL
cd $PROJECT_NAME
git status
# create a new file and add
echo "print('new')" > newpythonfile.py
cat newpythonfile.py # displays the new python file
{
"properties": {
"displayName": "NIST SP 800-53 R4",
"policyType": "BuiltIn",
"description": "This initiative includes audit and virtual machine extension deployment policies that address a subset of NIST SP 800-53 R4 controls. Additional policies will be added in upcoming releases. For more information, visit https://aka.ms/nist80053-blueprint.",
"metadata": {
"version": "2.0.1",
"category": "Regulatory Compliance"
},
"policyDefinitions": [
@brucedkyle
brucedkyle / new-managementgrouproot.ps1
Last active June 27, 2020 18:35
Set up management groups
#Requires -Version 7.0
#Requires -Modules PowerShellGet, Az.Resources
<#
.SYNOPSIS
Creates a management group
.DESCRIPTION
Creates a management group
.PARAMETER OrganizationName
Used to create the management group name
.OUTPUTS
@brucedkyle
brucedkyle / set-security-center.ps1
Last active June 18, 2020 16:46
Set up Security Center
#Requires -Version 7.0
#Requires -Modules PowerShellGet, Az.Resources, Az.Security
<#
.SYNOPSIS
Sets up Security Center and the admin alerts for the subscription
.DESCRIPTION
Automatically sets Security Center standard tier to the subscription.
.PARAMETER OrganizationName
Used to create the management group name
.PARAMETER LogAnalyticsWorkplaceId
@brucedkyle
brucedkyle / add-log-analytics-reader-group-to-aad.ps1
Last active June 12, 2020 21:29
Set up Log Analytics workspace
Install-Module azuread
New-AzureADGroup -Description "Log Analytics Reader Group" -DisplayName "Log Analytics Reader Group" -MailEnabled $false -SecurityEnabled $true -MailNickName "LogAnalyticsReaderGroup"
@brucedkyle
brucedkyle / code.sh
Last active June 5, 2020 22:43
Set up Azure tooling
# Set the root path for extensions
code --extensions-dir <dir>
# List the installed extensions.
code --list-extensions
# Install extension
code --install-extension (<extension-id> | <extension-vsix-path>)
# Uninstalls an extension.
@brucedkyle
brucedkyle / create-resource-group.sh
Last active June 3, 2020 20:57
Naming Convention for Azure Resources
REGION_ABBR="wu2"
ENVIRONMENT="dev"
PROJECT="azdays"
ITERATION="01"
LOCATION="West US 2"
RESOURCE_GROUP_NAME=rg-${REGION_ABBR}-${ENVIRONMENT}-${PROJECT}-${ITERATION}
TAGS=("Cost Center=AzDays" "Location=West US 2")
az group create --name $RESOURCE_GROUP_NAME --location "$LOCATION" --tags "${TAGS[@]}"
@brucedkyle
brucedkyle / terminal-split-pane.ps1
Created May 26, 2020 20:49
Windows Terminal Split Pane
wt -p "Command Prompt" `; split-pane -p "Windows PowerShell" `; split-pane -H wsl.exe
@brucedkyle
brucedkyle / boilerplate-armtemplate.ps1
Last active May 7, 2020 18:38
Boilerplate to deploy ARM Templates
#Requires -Version 5.1
#Requires -Modules Az.Resources, Az.Storage
<#
.SYNOPSIS
Deploys the resource using the boilerplate template
.DESCRIPTION
Deploys the boilerplate template to the resource group.
.PARAMETER SubscriptionID
The Azure Subscription ID, such as "9f241d6e-16e2-4b2b-a485-cc546f04799b". Uses the current subscription as the default.
.PARAMETER ResourceGroupName
@brucedkyle
brucedkyle / aks.tf
Last active May 23, 2020 22:45
Create AKS service using Terraform
resource "azurerm_kubernetes_cluster" "k8s" {
name = var.cluster_name
location = azurerm_resource_group.rg_aks.location
resource_group_name = azurerm_resource_group.rg_aks.name
dns_prefix = var.dns_prefix
linux_profile {
admin_username = var.admin_name
ssh_key {