Skip to content

Instantly share code, notes, and snippets.

Pete Skelly pkskelly

Block or report user

Report or block pkskelly

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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
Created May 6, 2019
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
Created Dec 22, 2018
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=environments.json
TMP_FLOWS=flows.json
TMP_OWNERS=owners.json
TMP_MAPPEDFLOWS=mappedFlows.json
TMP_FLOWSCSV=flows.csv
@pkskelly
pkskelly / merge.jq
Created Dec 22, 2018
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, mail}}) | add) as $dict
# output each flow and append the the owner information 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}"
;;
@pkskelly
pkskelly / SMATCollector.ps1
Created Jul 3, 2017
Simple Script to combine all SMAT CSV files into a single file
View SMATCollector.ps1
$csvFiles = Get-ChildItem $PSScriptRoot -Include *.csv -Recurse
$fileCount = $csvFiles.Count
Write-Host "Processing files: ($fileCount)"
foreach ($csv in $csvFiles) {
Write-Host "Processing $($csv.BaseName)..."
}
$outputfilename = read-host "Please enter the output file name"
@pkskelly
pkskelly / createproj.sh
Last active Mar 27, 2017
Simple .NET Core CLI set of commands to create a solution with referenced projects on a Mac.
View createproj.sh
#create the solution
dotnet new sln -n CandidateManager
#create the Console project
dotnet new console --name CandidatesConsole --output CandidatesConsole
#create the web project
dotnet new webapi --name CandidatesWeb --output CandidatesWeb
# These are the templates available from ASP.NET JavaScript Services https://github.com/aspnet/JavaScriptServices
@pkskelly
pkskelly / Send-SendGridMessage.ps1
Created Dec 2, 2015
Sending Email from PowerShell using SendGrid (in Azure)
View Send-SendGridMessage.ps1
$Username ="azure_*********@azure.com"
$Password = ConvertTo-SecureString "********" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential $Username, $Password
$SMTPServer = "smtp.sendgrid.net"
$EmailFrom = "admin@acme.com"
$EmailTo = "user@acme.com"
$Subject = "SendGrid test"
$Body = "SendGrid testing successful"
Send-MailMessage -smtpServer $SMTPServer -Credential $credential -Usessl -Port 587 -from $EmailFrom -to $EmailTo -subject $Subject -Body $Body
You can’t perform that action at this time.