Skip to content

Instantly share code, notes, and snippets.

View garrytrinder's full-sized avatar
👨‍💻
CLI for Microsoft 365

Garry Trinder garrytrinder

👨‍💻
CLI for Microsoft 365
View GitHub Profile
@kamilogorek
kamilogorek / _screenshot.md
Last active May 27, 2024 12:50
Clutter-free VS Code Setup
image
@phillipharding
phillipharding / Azure AD Token using Certificate Secret.md
Last active June 18, 2024 08:34
Generate an Azure AD Access Token using the Client Credentials flow with a Certificate Secret to use for calling the SharePoint REST API
@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`
@JudahGabriel
JudahGabriel / Resources.md
Last active October 26, 2021 17:58
Building rich app experiences with Progressive Web apps
<# Script to update the configuration (definition) of a Power Automate Flow
# This is an EXAMPLE script and assumes you have a flow with the two placeholder values - amend the parameters and config accordingly #>
<#
.SYNOPSIS
Update the config/any hardcoded values in a Flow using placeholders
.EXAMPLE
Update-FlowConfig.ps1 -SiteURL 'https://mytenant.sharepoint.com/sites/testsite' -ListID '0d1caedb-c38d-48b0-ba4a-e0fd5218c38b' -FlowPackagePath 'C:\Users\johndoe\Documents\Flows\MyFlow\'
SiteURL : URL to the SharePoint site (assuming a SharePoint trigger)
@ng-marcus
ng-marcus / login.js
Created October 9, 2019 13:10
Authenticating to Office 365 SSO with Cypress
/// <reference types="Cypress" />
const xml = `<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action>
<a:ReplyTo>
@mrik23
mrik23 / PnP-SharePointOnline-RestAPI-AuthAccessToken.ps1
Last active July 9, 2019 15:05
PowerShell script to demonstrate how to make calls to SharePoint Online API using authorization token retrieved with PnP PowerShell
<#
PowerShell script to demonstrate how to make calls to SharePoint Online API using authorization token retrieved with PnP PowerShell
This should work if the SharePoint tenant has LegacyAuthProtocolsEnabled as FALSE (legacy form based auth not authorized)
You need to have SharePoint Online PnP PowerShell installed https://github.com/SharePoint/PnP-PowerShell
#>
$spoUrl = "https://<tenant>.sharepoint.com"
$connection = Connect-PnPOnline -Url $spoUrl -Credentials UserCredential -ReturnConnection
@paolocarrasco
paolocarrasco / README.md
Last active July 18, 2024 17:08
How to understand the `gpg failed to sign the data` problem in git

Problem

You have installed GPG, then tried to commit and suddenly you see this error message after it:

error: gpg failed to sign the data
fatal: failed to write commit object

Debug

@pieterdv
pieterdv / get-aad-token.js
Created May 30, 2018 12:01
Login through Azure AD with puppeteer
function getAadToken(user, password, identifier) {
return puppeteer.launch({ headless: true }).then(async browser => {
try {
const page = await browser.newPage();
await page.goto("SITEURL");
await page.click(
"LOGINBUTTON"
);
@jbutko
jbutko / statelessComponent.tsx
Last active July 8, 2020 19:15
Stateless/dumb React component in Typescript
// stateless/dumb component in React Typescript
import * as React from 'react';
interface IWelcomeProps {
name: string,
}
const Welcome: React.SFC<IWelcomeProps> = ({ name }) => {
return <h1>Hello, {name}</h1>;
}