Skip to content

Instantly share code, notes, and snippets.

View smaring's full-sized avatar
🤪

Steve Maring smaring

🤪
View GitHub Profile
@smaring
smaring / get-microsoft-access-token.sh
Last active December 31, 2022 13:15
Construct a JWT assertion in bash using client-credential with cert to get an access token from Microsoft Azure Directory
#!/bin/bash
# Copyright 2022 Hitachi Vantara. All rights reserved.
# Author: Steve Maring <[email protected]>
#
# Description: Given an Azure Directory app's tenant id, client id, and a pfx file, this provides
# a mechanism to obtain a temporary access token via command line. The access token may be
# used to do things like send email via the Graph API.
#
# System Requirements: openssl, sed, awk, curl, jq