Comments on: Using the Microsoft Graph SDK for PowerShell with Azure Automation https://practical365.com/microsoft-graph-sdk-powershell-azure-automation/ Practical Office 365 News, Tips, and Tutorials Sat, 08 Jun 2024 11:28:00 +0000 hourly 1 https://wordpress.org/?v=6.6.1 By: <div class="apbct-real-user-wrapper"> <div class="apbct-real-user-author-name">Tony Redmond</div> <div class="apbct-real-user-badge" onmouseover=" let popup = document.getElementById('apbct_trp_comment_id_295157'); popup.style.display = 'inline-flex'; "> <div class="apbct-real-user-popup" id="apbct_trp_comment_id_295157"> <div class="apbct-real-user-title"> <p class="apbct-real-user-popup-header">The Real Person!</p> <p class="apbct-real-user-popup-text">Author <b>Tony Redmond</b> acts as a real person and passed all tests against spambots. Anti-Spam by CleanTalk.</p> </div> </div> </div> </div> https://practical365.com/microsoft-graph-sdk-powershell-azure-automation/#comment-295157 Sat, 08 Jun 2024 11:28:00 +0000 https://practical365.com/?p=55223#comment-295157 In reply to Anindya Kumar Banerjee.

I have no idea. I have spent zero time looking into Bicep. My brief experience of it indicated that Bicep wasn’t well aligned with the PowerShell modules for Microsoft 365, so I would stay with Azure Automation.

]]>
By: Anindya Kumar Banerjee https://practical365.com/microsoft-graph-sdk-powershell-azure-automation/#comment-295154 Sat, 08 Jun 2024 11:05:34 +0000 https://practical365.com/?p=55223#comment-295154 Hi Tony, I have used PowerShell for Office 365 core services either to run scripts only once or scheduled them through task scheduler. I have always wondered if there was a better way to automate, for example, daily reporting. Then someone advised me to use Azure Automation Runbooks, for tasks like automatically enabling archive mailbox for every new user mailbox created. Next, I learnt about infrastructure as a code and Microsoft365DSC. But my current organization uses Azure DevOps with Bicep for IaC. As someone primarily responsible for Exchange Online, I wonder what the best tools and platforms are for automating tasks and managing configuration.

]]>
By: <div class="apbct-real-user-wrapper"> <div class="apbct-real-user-author-name">Tony Redmond</div> <div class="apbct-real-user-badge" onmouseover=" let popup = document.getElementById('apbct_trp_comment_id_291951'); popup.style.display = 'inline-flex'; "> <div class="apbct-real-user-popup" id="apbct_trp_comment_id_291951"> <div class="apbct-real-user-title"> <p class="apbct-real-user-popup-header">The Real Person!</p> <p class="apbct-real-user-popup-text">Author <b>Tony Redmond</b> acts as a real person and passed all tests against spambots. Anti-Spam by CleanTalk.</p> </div> </div> </div> </div> https://practical365.com/microsoft-graph-sdk-powershell-azure-automation/#comment-291951 Tue, 09 Apr 2024 17:59:18 +0000 https://practical365.com/?p=55223#comment-291951 In reply to Olu.

Use a managed identity, certificate, or credentials to identify which account the Graph SDK should use. Here’s how to use a managed identity: https://practical365.com/managed-identity-powershell/

]]>
By: Olu https://practical365.com/microsoft-graph-sdk-powershell-azure-automation/#comment-291949 Tue, 09 Apr 2024 17:56:39 +0000 https://practical365.com/?p=55223#comment-291949 How can I configure my automation account to connect to MS graph using below PS script?
Connect-MgGraph -Scopes “User.Read.All”, “GroupMember.Read.All”, “Group.Read.All”, “Directory.Read.All”

I keep getting error below:

Authentication needed. Please call Connect-MgGraph.
Authentication needed. Please call Connect-MgGraph.
Authentication needed. Please call Connect-MgGraph.
Authentication needed. Please call Connect-MgGraph.
Authentication needed. Please call Connect-MgGraph.
Authentication needed. Please call Connect-MgGraph.
Could not find a part of the path ‘C:\ocio\AzureADMembers.csv’.

]]>
By: <div class="apbct-real-user-wrapper"> <div class="apbct-real-user-author-name">Tony Redmond</div> <div class="apbct-real-user-badge" onmouseover=" let popup = document.getElementById('apbct_trp_comment_id_281519'); popup.style.display = 'inline-flex'; "> <div class="apbct-real-user-popup" id="apbct_trp_comment_id_281519"> <div class="apbct-real-user-title"> <p class="apbct-real-user-popup-header">The Real Person!</p> <p class="apbct-real-user-popup-text">Author <b>Tony Redmond</b> acts as a real person and passed all tests against spambots. Anti-Spam by CleanTalk.</p> </div> </div> </div> </div> https://practical365.com/microsoft-graph-sdk-powershell-azure-automation/#comment-281519 Mon, 20 Nov 2023 12:01:15 +0000 https://practical365.com/?p=55223#comment-281519 In reply to Henrik.

I just noticed the update!

]]>
By: Henrik https://practical365.com/microsoft-graph-sdk-powershell-azure-automation/#comment-281517 Mon, 20 Nov 2023 11:56:06 +0000 https://practical365.com/?p=55223#comment-281517 In reply to Tony Redmond.

AHA! Three days ago Microsoft released 2.9.1 where they apparently fixed the bug with login for Managed Identity! When I update to that version the script works again! 🙂

]]>
By: Henrik https://practical365.com/microsoft-graph-sdk-powershell-azure-automation/#comment-281516 Mon, 20 Nov 2023 11:42:01 +0000 https://practical365.com/?p=55223#comment-281516 In reply to Tony Redmond.

Hi Tony! 🙂 I have the same problem here. A runbook with Graph Auth module 2.7.0 works as it should in dev tenant. When I moved it to prod tenant the module installed became 2.9.0. The exact same code will not auth with 2.9.0 that auths with 2.7.0. Was there a bug introduced in 2.9.0 that causes it to fail with Managed Identity auth? Gaahhh!

]]>
By: Tony Redmond https://practical365.com/microsoft-graph-sdk-powershell-azure-automation/#comment-280708 Tue, 14 Nov 2023 09:56:14 +0000 https://practical365.com/?p=55223#comment-280708 In reply to Justin Nobles.

Do you normally address people by their surname?

In any case, have you read the other articles published here about using managed identities with different modules?

But the first thing I would do is update the resource modules in the Azure Automation account to make sure that you’re using the latest versions. https://practical365.com/update-graph-sdk-azure-automation/

]]>
By: Justin Nobles https://practical365.com/microsoft-graph-sdk-powershell-azure-automation/#comment-280706 Tue, 14 Nov 2023 09:35:18 +0000 https://practical365.com/?p=55223#comment-280706 In reply to Tony Redmond.

Hi Redmond,
thanks for the great article. Have you found the time to explore the use of managed identities?
I have tried myself but get stuck with connection issues:

I receive the following error msg when solely running “connect-mggraph -Identity” inside of an Azure Runbook:

ManagedIdentityCredential authentication failed: Could not load file or assembly ‘System.Memory.Data, Version=1.0.2.0, Culture=neutral, PublicKeyToken=************’. The system cannot find the file specified.
See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/managedidentitycredential/troubleshoot

Haven’t found a way to work around this yet. Any suggestions?

]]>
By: Anders https://practical365.com/microsoft-graph-sdk-powershell-azure-automation/#comment-242621 Sun, 04 Sep 2022 17:45:41 +0000 https://practical365.com/?p=55223#comment-242621 In reply to Liam O Neill.

I am here looking for the same thing! Been breaking it down step by step. Haven’t been able to pull it off yet though.

]]>