MgGraph is not recognized as a name of a cmdlet, function, script file, or executable program

Ryan Close 20 Reputation points
2023-12-05T20:52:37.6566667+00:00

I have an "Automation Account" in Azure that has a Runbook that will not connect to "MgGraph" The first error in the ""All Logs" 'Connect-MgGraph: Line | 2 | Connect-MgGraph -Identity | ~~~~~~~~~~~~~~~ | The term 'Connect-MgGraph' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.'

Microsoft.Graph.Authentication is loaded in the Automation Account "Modules" version 10.2

Import-Module Microsoft.Graph.Authentication is present in the script

Then -- Connect-MgGraph -Identity

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,368 questions
{count} votes

Accepted answer
  1. Dillon Silzer 57,831 Reputation points Volunteer Moderator
    2023-12-06T06:03:20.9966667+00:00

    Hi Ryan,

    Try deploying it to Azure Automation via the Microsoft Graph Authentication module page.

    User's image

    Cited from https://www.powershellgallery.com/packages/Microsoft.Graph.Authentication/2.10.0


    If this is helpful please accept answer.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.