This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your tenant id (Azure Portal 🡪 Azure Active Directory 🡪 Overview) | |
$TenantID="" | |
# Microsoft Graph App ID (DON'T CHANGE - Microsoft Graph ID is the same in all tenants) | |
$GraphAppId = "00000003-0000-0000-c000-000000000000" | |
#Specify the Managed Identity ID. (Azure Portal 🡪 Azure resource instance (in our example – Automation Account) 🡪 Managed Identity) | |
$ManagedIdentityID ="" | |
# Add the permission you need for the operation (the below permissions are needed in our scenario) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Connect-AzAccount using Azure Automation Managed Identity | |
Connect-AzAccount -identity | |
#Sign in to MgGraph | |
function Get-AzToken | |
{ | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true)] | |
[String] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Connect-AzAccount using Azure Automation Managed Identity | |
Connect-AzAccount -identity | |
#Sign in to MgGraph | |
function Get-AzToken | |
{ | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true)] | |
[String] |