Skip to content

Instantly share code, notes, and snippets.

View techdecline's full-sized avatar

Cornelius Schuchardt techdecline

View GitHub Profile
@techdecline
techdecline / tf_azure_resource_type
Last active May 12, 2022 11:07
Terraform Zip Map on Resource Type
module "policy_set_key_vault_restrictions" {
source = "./modules/policy_set"
name = "keyVaultRestrictions"
display_name = "Deny unsupported encryption mechanisms in Key Vault"
description = "Deny unsupported encryption mechanisms in Key Vault"
location = var.location
set_definition_scope = data.azurerm_management_group.gothaernext.id
policy_definition_builtin_ids = [
"/providers/Microsoft.Authorization/policyDefinitions/1151cede-290b-4ba0-8b38-0ad145ac888f",
"/providers/Microsoft.Authorization/policyDefinitions/cee51871-e572-4576-855c-047c820360f0",
param(
[Parameter(Mandatory)]
[String]$Name
)
Write-Output "Hello $Name"
@techdecline
techdecline / azure-pipelines-tf.yaml
Last active February 10, 2022 13:53
AzDevOps Terraform Pipeline Template
trigger:
- master
- feature/*
pr:
branches:
include:
- '*'
pool:
@techdecline
techdecline / Assign-DrsRules.ps1
Created October 25, 2021 13:28
Create new VMware vSphere DRS Groups and Rules
[cmdletbinding()]
param (
# vCenter Name
[Parameter(Mandatory)]
[ValidateScript({Test-NetConnection -ComputerName $_ -Port 443})]
[string]
$vCenterName,
# vCenter Credentials
[Parameter(Mandatory)]
@techdecline
techdecline / Cleanup-K8sWorkloads.ps1
Created October 25, 2021 07:49
Kubernetes Maintenance
#region Cleanup Failed Pods
# get all pods
$allPods = (. kubectl get pods --all-namespaces -o json | ConvertFrom-Json).items
# get failed pods
$failedPods = $allPods | Where-Object {$_.status.phase -eq "Failed"}
# remove failed pods
$failedPods | ForEach-Object {
. kubectl delete pod $($_.metadata.name) -n $($_.metadata.namespace)
[cmdletbinding()]
param (
# vCenter Name
[Parameter(Mandatory)]
[ValidateScript({Test-NetConnection -ComputerName $_ -Port 443})]
[string]
$vCenterName,
# vCenter Credentials
[Parameter(Mandatory)]
@techdecline
techdecline / Init-Gitlab.sh
Created September 9, 2021 08:35
Init-Gitlab-EE-Server
#!/bin/bash
external_url=$(wc -l < $1)
password=$(wc -l < $2)
# All actions based on https://docs.gitlab.com/ee/install/azure/
export config_file=/etc/gitlab/gitlab.rb
# Replace External URL
sed -i "s,external_url.*$,external_url $external_url,g" $config_file
@techdecline
techdecline / Test-ChocoPackage_adobereader.ps1
Created June 15, 2021 07:21
Update Adobereader Using Proactive Remediation
[cmdletbinding()]
param (
[Parameter(Mandatory=$false)]
[String]$PackageName = "adobereader"
)
function Test-Choco
{
[CmdletBinding()]
param (
@techdecline
techdecline / Update-ChocoPackage.ps1
Created June 15, 2021 05:20
Update-ChocoPackage.ps1
[cmdletbinding(DefaultParameterSetName="Default",SupportsShouldProcess=$true)]
param (
[Parameter(Mandatory,ParameterSetName="ByPackageName")]
[String]$PackageName,
[Parameter(Mandatory,ParameterSetName="ByGlobalList")]
[Switch]$UpdateAll
)
function Test-Choco
#Requires -Modules LogStream,Az.Storage,Microsoft.Graph.Intune
[CmdletBinding()]
param (
# Image File Path
[Parameter(Mandatory)]
[ValidateScript({Test-Path -Path $_})]
[String]
$ImagePath,
# Select Wallpaper or Lockscreen