MgGraph with Azure Automation Runbook
Hi,
I am trying to use MgGraph in an Azure runbook but keep hitting a dead end and would appreciate any suggestions. I have the MgGraph modules loaded in the Automation account and credentials saved in the credentials section of the automation account. To test I am just trying to connect to MgGraph first but failing to even do this. This is my PowerShell code:
$Cred = Get-AutomationPSCredential -Name "#######"
Install-Module -Name Microsoft.Graph
Connect-MgGraph -ClientID $TAECred -TenantID "########-####-####-####-############"
The error I receive is:
Connect-MgGraph : The term 'Connect-MgGraph' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:5 char:1 + Connect-MgGraph -ClientID $Cred -TenantID "########-####-####-#### ... + ~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Connect-MgGraph:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Any ideas?