Skip to content

Instantly share code, notes, and snippets.

View prombouts's full-sized avatar
🏠
Working from home

Peter Rombouts prombouts

🏠
Working from home
View GitHub Profile
@prombouts
prombouts / raspberrypi-temperature-logic-app.json
Created August 13, 2022 08:06
Receive temperature from Node-RED and evaluate
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Condition": {
"actions": {
"Send_an_email_(V2)": {
"inputs": {
"body": {
"Body": "<p>Warning: RaspberryPi Temperature reached @{variables('Temperature')}</p>",
@prombouts
prombouts / raspberrypi-temperature-node-red.json
Created August 13, 2022 07:59
Get Raspberry PI temperature and call LogicApp
[
{
"id": "cdd3427b60e26088",
"type": "tab",
"label": "Temp to LogicApp",
"disabled": false,
"info": "",
"env": []
},
{
@prombouts
prombouts / kics-pipeline.yml
Last active December 21, 2021 08:02
KICS.io example pipeline (tested with version 1.4.9)
###
# Example Azure DevOps pipeline accompanying blogpost: https://peterrombouts.nl/2021/05/13/static-code-analysis-of-infrastructure-as-code/
# Tested up until Kics.io version 1.4.9
###
trigger:
- none
pool:
vmImage: 'ubuntu-20.04'
@prombouts
prombouts / check_usage.sh
Last active October 6, 2021 13:38
Check usage limits in Azure
#!/bin/bash
echo "Starting..."
# Get all VM usage as json
vmjson=$(az vm list-usage --location westeurope -o json)
# Loop through all items and check whether limit has been reached
# If so, log to DevOps logger so pipeline will reflect warnings or errors
jq -c '.[]' <<< "$vmjson" | while read i; do
@prombouts
prombouts / get-latest-terraform.sh
Last active August 19, 2021 07:49
Install or update the latest Terraform binary on your WSL/Linux instance
#!/bin/bash
LATEST_RELEASE=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version)
CURRENT_RELEASE=$(terraform version -json | jq -r .terraform_version)
if [[ ${LATEST_RELEASE} != $CURRENT_RELEASE ]]; then
echo "Installing Terraform ${LATEST_RELEASE}..."
FILENAME=terraform_${LATEST_RELEASE}_linux_amd64.zip
wget https://releases.hashicorp.com/terraform/${LATEST_RELEASE}/$FILENAME
unzip $FILENAME && rm $FILENAME
$name = 'put-your-logicapp-name-here'
$resourcegroup = 'put-resource-group-here'
$subscription = {this_is_your_subscription_guid}
armclient token $subscription |
Get-LogicAppTemplate `
-LogicApp $name `
-ResourceGroup $resourcegroup `
-SubscriptionId $subscription `
-Verbose | Out-File C:\Temp\$name.json
@prombouts
prombouts / LogicAppOutlook365ToGoogleCalendar.json
Last active December 4, 2019 18:30
LogicApp Outlook365 to Google Calendar
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workflows_OutlookSync_name": {
"defaultValue": "OutlookSync",
"type": "String"
},
"connections_googlecalendar_externalid": {
"defaultValue": "/subscriptions/yoursub/resourceGroups/yourrg/providers/Microsoft.Web/connections/googlecalendar",

Keybase proof

I hereby claim:

  • I am prombouts on github.
  • I am prombouts (https://keybase.io/prombouts) on keybase.
  • I have a public key ASA-T-Dd0WYJR_Yww0hANe5oCAPh6NAlzDpL81aeAIuu2wo

To claim this, I am signing this object:

@prombouts
prombouts / Stop-Start-AzureVM-By-Tag.ps1
Last active February 28, 2019 08:18
This PowerShell Workflow runbook connects to Azure using an Automation Credential and Starts/Stops a VM/a list of VMs/All VMs in a Subscription in-parallel.
Workflow Stop-Start-AzureVM-By-Tag
{
Param
(
[Parameter(Mandatory=$true)][ValidateSet("Start","Stop")]
[String]
$Action,
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()]
[String]
$TagName="ScheduledOnOff",
{
"data": [
{
"date": "2017-01-01",
"usage": 1600
},
{
"date": "2017-01-02",
"usage": 1542
},