Skip to content

Instantly share code, notes, and snippets.


Phil Harding phillipharding

View GitHub Profile
garrytrinder /
Last active Oct 17, 2020
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
sp=`az ad sp create --id ${appObjectId}`
appId=`az ad app show --id ${appObjectId} --query "appId" --output tsv`