---
title: "Bruce (@bhgf) | Hashnode"
description: "Bruce (@bhgf) writes on Hashnode. Read their latest articles and follow their work."
url: "https://hashnode.com/@bhgf"
---

@bhgf

# Bruce

@bhgf · Joined May 2022

## Comments

[Ondrej Sebela Thanks, I confirmed the service principal name for the Azure Automation account using that command. The runbook does not really get stuck.What happens is that I run a test it edit mode.It completes, but I can tell the whole script has not run(as debug output statements are missing) Connect-AzAccount -Identity -> this works $MSI = (Get-AzAzureADServicePrincipal -Filter "displayName eq '$automationAccountDisplayName'")-> nothing is executed on or after this line](https://hashnode.com/posts/how-to-use-managed-identity-to-connect-to-azure-exchange-graph-intune-in-azure-automation-runbook/627d01164903bec29b587161/comment/62834b6b83e2720b553c65ec#reply-62835141504da209d85574e8)

Reply · Article · May 17, 2022 · [How to use Managed Identity to connect to Azure, Exchange, Graph, Intune,... in Azure Automation Runbook](https://hashnode.com/posts/how-to-use-managed-identity-to-connect-to-azure-exchange-graph-intune-in-azure-automation-runbook/627d01164903bec29b587161)

[I could not find anything else out there on this use case! But I have determined my runbook is getting stuck on: $MSI = (Get-AzureADServicePrincipal -Filter "displayName eq '$automationAccountDisplayName'" Pretty sure I got the $automationAccountDisplayName correct, so I am wondering what permissions I need to confirm exist, that perhaps you alluded to?](https://hashnode.com/posts/how-to-use-managed-identity-to-connect-to-azure-exchange-graph-intune-in-azure-automation-runbook/627d01164903bec29b587161/comment/62834b6b83e2720b553c65ec)

Comment · Article · May 17, 2022 · [How to use Managed Identity to connect to Azure, Exchange, Graph, Intune,... in Azure Automation Runbook](https://hashnode.com/posts/how-to-use-managed-identity-to-connect-to-azure-exchange-graph-intune-in-azure-automation-runbook/627d01164903bec29b587161)
