Skip to content

Instantly share code, notes, and snippets.

View phillipharding's full-sized avatar

Phil Harding phillipharding

View GitHub Profile
@phillipharding
phillipharding / Renew Expired SharePoint ACS ClientSecret.ps1
Last active October 26, 2022 11:04
Renews an Expired ClientSecret for a Sharepoint Addin/ACS App Registration
<#
Renew An Expired Clientsecret For A Sharepoint Addin/ACS App Registration
WHEN A SHAREPOINT ADDIN/ACS APP REGISTRATION IS CREATED THE CLIENTSECRET IS SET TO EXPIRE IN 1 YEAR
THIS SCRIPT WILL RENEW AN EXPIRED CLIENTSECRET WITH A VALUE THAT EXPIRES IN 3 YEARS
.\msol-renewsharepointaddinsecret.ps1 -clientId "" -userName "" -userPassword ""
#>
param (
@garrytrinder
garrytrinder / m365-identity.sh
Last active October 3, 2023 12:04
Create custom Azure AD identity for use with CLI for Microsoft 365 using Azure CLI
#!/usr/bin/env zsh
function createAppRegistration (){
local appName=$1
appObjectId=`az ad app create --display-name "${appName}" --oauth2-allow-implicit-flow false --query "objectId" --output tsv`
# Undocumented: You need to create the service principal to back the app registration
# https://github.com/Azure/azure-cli/issues/12797#issuecomment-612138520
sp=`az ad sp create --id ${appObjectId}`
appId=`az ad app show --id ${appObjectId} --query "appId" --output tsv`
@dsherret
dsherret / Using.ts
Last active October 26, 2023 13:30
Typescript Disposable (using statement)
// NOTE: This is now rolled up in a package and supports more scenarios: https://github.com/dsherret/using-statement
interface IDisposable {
dispose();
}
function using<T extends IDisposable>(resource: T, func: (resource: T) => void) {
try {
func(resource);
} finally {