Skip to content

Instantly share code, notes, and snippets.

Avatar

Pete Skelly pkskelly

View GitHub Profile
@pkskelly
pkskelly / Get-FlowOwners.ps1
Last active Mar 1, 2021
PowerShell Core script that retrieves and exports Flows and Owner information to CSV file
View Get-FlowOwners.ps1
#!/usr/local/bin/pwsh -File
$DIR = Split-Path $script:MyInvocation.MyCommand.Path
$TMP_DIR = "./tmp"
$FLOWSCSV_SUFFIX = "-flows.csv"
$ALLFLOWSCSV = "allflows.csv"
function CleanDistFolder {
# Remove the dist folder as needed
if (Test-Path -Path "$TMP_DIR" -PathType Container) {
@pkskelly
pkskelly / VSCodeTerminalKeybindings.json
Last active Jan 27, 2020
VS Code Terminal Keybindings to enable Ctrl+` to switch back to the editor and Shift+Cmd+] to move between active terminal sessions. Press cmd+shift+p and type keyboard to find Preferences: Open Keyboard Shortcuts File. Add the following to the keybindings.json or update the existing file and save it.
View VSCodeTerminalKeybindings.json
// Place your key bindings in this file to override the defaults
[
// Toggle to terminal focus
{
"key": "ctrl+`",
"command": "workbench.action.terminal.focus"
},
// Toggle to editor focus
{
"key": "ctrl+`",
@pkskelly
pkskelly / teamify-classicsite.sh
Last active Aug 13, 2019
Shell script using Office 365 CLI v2 to group enable and connect a MS Team to an existing SharePoint Online classic team site.
View teamify-classicsite.sh
#!/usr/bin/env bash
help() {
echo
echo " ****************************************************************"
echo " ** Teamify Classic Site "
echo " ** "
echo " ** Simple script to Groupify and Teamify a SharePoint Online Classic site"
echo " ** "
echo " ** Usage: ./teamify-classicsite.sh -s|--siteUrl [classic site url] -a|--alias [alias] -d|--description [description]"
@pkskelly
pkskelly / Get-MFAStatus.ps1
Last active May 17, 2019
List Users MFA Status for All Users
View Get-MFAStatus.ps1
#Connect-MsolService
Get-MsolUser -all |
Select-Object ObjectId, IsLicensed, DisplayName, UserPrincipalName, BlockCredential, UserType, WhenCreated, LastPasswordChangeTimestamp,LicenseReconciliationNeeded,
@{N = "Type"; E = { if ( $_.UserPrincipalName.IndexOf("#EXT#") -gt 0 ) { "External" } else { "ThreeWill" } } } ,
@{N = "MFAStatus"; E = { if ( $_.StrongAuthenticationRequirements.State -ne $null) { $_.StrongAuthenticationRequirements.State } else { "Disabled" } } } ,
@{N = "ConferenceRoom"; E = { if ( ($_.UserPrincipalName).IndexOf("conference") -gt 0) { $true } else { $false } } } ,
@{N = "ThreatLevel";
E = {
@pkskelly
pkskelly / update-ssl-binding.sh
Last active Oct 20, 2020
Script to update the SSL certificate for the URL Shortener (or any Azure Web App)
View update-ssl-binding.sh
APP_NAME=""
RESOURCE_GROUP=""
CERT_FILE=""
CERT_PASSWORD=""
thumbprint=$(az webapp config ssl upload \
--name $APP_NAME \
--resource-group $RESOURCE_GROUP \
--certificate-file $CERT_FILE \
@pkskelly
pkskelly / generate-flowreport.sh
Last active Apr 23, 2020
Bash script using Office 365 CLI and jq to create a csv report of Flow with mapped Owner details
View generate-flowreport.sh
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
TMP_ENVIRONMENTS=./tmp/environments.json
TMP_FLOWS=./tmp/flows.json
TMP_OWNERS=./tmp/owners.json
TMP_MAPPEDFLOWS=./tmp/mappedFlows.json
TMP_FLOWSCSV=flows-frombash.csv
@pkskelly
pkskelly / merge.jq
Last active Apr 23, 2020
Merge jq module to merge MS Flow JSON output with Azure AD user information
View merge.jq
# Create a dictionary based on the $owner.id property from the owners array parameter
($owners | map(select(.id != null)) | map( {(.id): {displayName, userPrincipalName, mail}}) | add) as $dict
# Output each flow and append the the owner information from each dictionary entry
# using the flow's creator.userId property as the key
| $flows |.[].properties.creator |= . + $dict[.userId]
@pkskelly
pkskelly / hubsites.rest
Created May 9, 2018
Template for HubSite REST Calls. You can copy this file, load the REST Client Extension in VS Code and run the samples. Some configuration and knowledge of OAuth is required.
View hubsites.rest

@host = tenant-name @hubname = hubsite-name @token = Bearer bearer-toekn-value @hubid = hub-id @spokeid = spoke-id @company = your-company

### CanCreate - determine if current user can create a hubsite GET https://{{host}}-admin.sharepoint.com/_api/sp.hubsites.cancreate Accept: application/json

@pkskelly
pkskelly / removeNGStorage.sh
Created Dec 22, 2017
Azure CLI script to remove Blob storage containers serving Angular static files.
View removeNGStorage.sh
#!/bin/bash
AZURE_STORAGE_ACCOUNT=""
AZURE_STORAGE_ACCESS_KEY=""
while getopts "a:k:" opt; do
case $opt in
a)
AZURE_STORAGE_ACCOUNT="${OPTARG}"
;;
@pkskelly
pkskelly / configureNGStorage.sh
Created Dec 22, 2017
Azure CLI script to enable Blob storage containers to serve Angular static files.
View configureNGStorage.sh
#!/bin/bash
AZURE_STORAGE_ACCOUNT=""
AZURE_STORAGE_ACCESS_KEY=""
while getopts "a:k:" opt; do
case $opt in
a)
AZURE_STORAGE_ACCOUNT="${OPTARG}"
;;