Update
For the latest version of this code please visit msgraph-sdk-powershell-examples.
Deprecated Content
Obtaining an Access Token for Microsoft Graph from an Azure Automation Account Runbook using a system-assigned managed identity using PowerShell and the Invoke-RestMethod
cmdlet.