Skip to content

Instantly share code, notes, and snippets.

View waldekmastykarz's full-sized avatar
🥑
Microsoft 365

Waldek Mastykarz waldekmastykarz

🥑
Microsoft 365
View GitHub Profile
@waldekmastykarz
waldekmastykarz / sharepoint-rest.yml
Created March 31, 2025 08:57
SharePoint REST API API spec
openapi: 3.0.4
info:
title: SharePoint REST API
description: SharePoint REST API
version: v1.0
servers:
- url: https://{tenant}.sharepoint.com
variables:
tenant:
default: contoso
@waldekmastykarz
waldekmastykarz / delete-old-entra-apps.sh
Created November 20, 2024 10:22
Delete old Microsoft Entra app registrations
# Remove Microsoft Entra app registrations created before Jan 1, 2024
# Requires CLI for Microsoft 365 and jq
m365 entra app list -o json --query "[?createdDateTime < '2024-01-01T00:00:00Z'].appId" | jq -r '.[]' | while read -r line; do
echo "Removing $line..."
m365 entra app remove --appId "$line" --force
done
@waldekmastykarz
waldekmastykarz / devproxyrc.json
Last active September 25, 2024 14:50
Dev Proxy configuration to simulate access key authentication for Azure Functions
{
"$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.21.0/rc.schema.json",
"plugins": [
{
"name": "AuthPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
"configSection": "apiKey"
}
],
@waldekmastykarz
waldekmastykarz / msi.bicep
Last active August 9, 2024 15:37
Create MSI with app roles assigned
extension microsoftGraph
resource identity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
location: resourceGroup().location
name: 'my-connector'
}
resource graphSp 'Microsoft.Graph/[email protected]' existing = {
appId: '00000003-0000-0000-c000-000000000000'
}
@waldekmastykarz
waldekmastykarz / entra-app-reg.bicep
Created August 9, 2024 15:34
Create Entra app reg, with a service principal and admin consent using bicep
extension microsoftGraph
resource appRegistration 'Microsoft.Graph/[email protected]' = {
displayName: 'My Graph connector'
uniqueName: 'my-graph-connector'
signInAudience: 'AzureADMyOrg'
requiredResourceAccess: [
{
resourceAppId: '00000003-0000-0000-c000-000000000000'
resourceAccess: [
@waldekmastykarz
waldekmastykarz / list-view.json
Created January 30, 2024 11:53
List board view with colored cards following the card status
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/board-formatting.schema.json",
"hideSelection": false,
"formatter": {
"elmType": "div",
"attributes": {
"class": "sp-card-container sp-card-container-noPadding"
},
"children": [
{
@waldekmastykarz
waldekmastykarz / customers-api.json
Last active December 20, 2023 15:38
Dev Proxy CRUD API
{
"$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v1.0/crudapi.schema.json",
"baseUrl": "https://api.contoso.com/v1/customers",
"dataFile": "customers-data.json",
"actions": [
{
"action": "getAll"
},
{
"action": "getOne",
@waldekmastykarz
waldekmastykarz / c#-lambda-queries.json
Last active December 20, 2023 07:02
Customers API definition
{
"baseUrl": "https://api.contoso.com/v1/customers",
"dataFile": "customers-data.json",
"actions": [
{
"action": "getAll"
},
{
"action": "getOne",
"url": "/{customer-id}",
@waldekmastykarz
waldekmastykarz / trust-cert.sh
Created December 16, 2023 14:35
Trust a certificate on macOS
# export cert from keychain to PEM
security find-certificate -c "Titanium Root Certificate Authority" -a -p > proxy-cert.pem
# add trusted cert to keychain
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db proxy-cert.pem
@waldekmastykarz
waldekmastykarz / setup.ps1
Created December 15, 2023 15:47
Proxy setup
New-Item -ItemType Directory -Force -Path .\devproxy -ErrorAction Stop | Out-Null
Set-Location .\devproxy | Out-Null
# Get the full path of the current directory
$full_path = Resolve-Path .
# Get the latest Dev Proxy version
Write-Host "Getting latest Dev Proxy version..."
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/dev-proxy/releases/latest" -ErrorAction Stop
$version = $response.tag_name