microsoftgraph / msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
https://www.powershellgallery.com/packages/Microsoft.Graph
Other
699 stars 168 forks source link

The term 'Connect-MgGraph' is not recognized as the name of a cmdlet, function, script file, or operable program. #1240

Closed gouthambaskarn closed 2 years ago

gouthambaskarn commented 2 years ago

I am trying to run the AzureADExporterModule to export configurations from our Azure AD tenant.

However, when I try to connect to the module, I get the below error.

PS C:\Users\HIDDEN> Connect-AzureADExporter 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 C:\Users\CA-D-Win-Admin-17\Documents\WindowsPowerShell\Modules\AzureADExporter\1.0.908740\Connect-AzureADExporter.ps1:20 char:5

Get-MgContext : The term 'Get-MgContext' 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 C:\Users\CA-D-Win-Admin-17\Documents\WindowsPowerShell\Modules\AzureADExporter\1.0.908740\Connect-AzureADExporter.ps1:34 char:5

Get-MgContext : The term 'Get-MgContext' 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 C:\Users\CA-D-Win-Admin-17\Documents\WindowsPowerShell\Modules\AzureADExporter\1.0.908740\Connect-AzureADExporter.ps1:35 char:25

Provided below is info on the installed modules.

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

Version | Name | Repository -- | -- | -- 0.5.0 | Azure.AnalysisServices | PSGallery 4.2.0 | Azure.Storage | PSGallery 2.0.1.3 | AzureAD | PSGallery 2.0.2.136 | AzureADPreview | PSGallery 5.5.0 | AzureRM | PSGallery 0.6.4 | AzureRM.AnalysisServices | PSGallery 5.1.0 | AzureRM.ApiManagement | PSGallery 0.1.1 | AzureRM.ApplicationInsights | PSGallery 4.3.0 | AzureRM.Automation | PSGallery 4.0.2 | AzureRM.Backup | PSGallery 4.0.4 | AzureRM.Batch | PSGallery 0.14.0 | AzureRM.Billing | PSGallery 4.2.0 | AzureRM.Cdn | PSGallery 0.9.2 | AzureRM.CognitiveServices | PSGallery 4.4.0 | AzureRM.Compute | PSGallery 0.3.0 | AzureRM.Consumption | PSGallery 0.2.3 | AzureRM.ContainerInstance | PSGallery 1.0.2 | AzureRM.ContainerRegistry | PSGallery 4.2.0 | AzureRM.DataFactories | PSGallery 0.5.1 | AzureRM.DataFactoryV2 | PSGallery 4.2.1 | AzureRM.DataLakeAnalytics | PSGallery 5.1.1 | AzureRM.DataLakeStore | PSGallery 4.0.2 | AzureRM.DevTestLabs | PSGallery 4.0.1 | AzureRM.Dns | PSGallery 0.3.1 | AzureRM.EventGrid | PSGallery 0.6.1 | AzureRM.EventHub | PSGallery 4.1.0 | AzureRM.HDInsight | PSGallery 4.0.2 | AzureRM.Insights | PSGallery 3.1.0 | AzureRM.IotHub | PSGallery 4.2.0 | AzureRM.KeyVault | PSGallery 4.0.1 | AzureRM.LogicApp | PSGallery 0.17.0 | AzureRM.MachineLearning | PSGallery 0.4.0 | AzureRM.MachineLearningCompute | PSGallery 0.2.0 | AzureRM.MarketplaceOrdering | PSGallery 0.9.0 | AzureRM.Media | PSGallery 5.3.0 | AzureRM.Network | PSGallery 4.1.0 | AzureRM.NotificationHubs | PSGallery 4.3.0 | AzureRM.OperationalInsights | PSGallery 4.1.2 | AzureRM.PowerBIEmbedded | PSGallery 4.4.0 | AzureRM.profile | PSGallery 4.1.0 | AzureRM.RecoveryServices | PSGallery 4.1.0 | AzureRM.RecoveryServices.Backup | PSGallery 0.2.2 | AzureRM.RecoveryServices.SiteRec... | PSGallery 4.1.0 | AzureRM.RedisCache | PSGallery 0.3.1 | AzureRM.Relay | PSGallery 5.5.0 | AzureRM.Resources | PSGallery 0.16.1 | AzureRM.Scheduler | PSGallery 4.1.0 | AzureRM.ServerManagement | PSGallery 0.6.2 | AzureRM.ServiceBus | PSGallery 0.3.2 | AzureRM.ServiceFabric | PSGallery 5.0.4 | AzureRM.SiteRecovery | PSGallery 4.3.0 | AzureRM.Sql | PSGallery 4.2.1 | AzureRM.Storage | PSGallery 4.0.2 | AzureRM.StreamAnalytics | PSGallery 4.0.0 | AzureRM.Tags | PSGallery 4.0.1 | AzureRM.TrafficManager | PSGallery 4.0.1 | AzureRM.UsageAggregates | PSGallery 4.2.0 | AzureRM.Websites | PSGallery 7.4.1 | ImportExcel | PSGallery 1.6.1 | Microsoft.Graph | PSGallery 1.6.1 | Microsoft.Graph.Applications | PSGallery 1.9.5 | Microsoft.Graph.Authentication | PSGallery 1.6.0 | Microsoft.Graph.Bookings | PSGallery 1.6.0 | Microsoft.Graph.Calendar | PSGallery 1.6.0 | Microsoft.Graph.ChangeNotifications | PSGallery 1.6.1 | Microsoft.Graph.CloudCommunications | PSGallery 1.6.1 | Microsoft.Graph.Compliance | PSGallery 1.6.0 | Microsoft.Graph.CrossDeviceExper... | PSGallery 1.6.1 | Microsoft.Graph.DeviceManagement | PSGallery 1.6.1 | Microsoft.Graph.DeviceManagement... | PSGallery 1.6.1 | Microsoft.Graph.DeviceManagement... | PSGallery 1.6.0 | Microsoft.Graph.DeviceManagement... | PSGallery 1.6.0 | Microsoft.Graph.DeviceManagement... | PSGallery 1.6.1 | Microsoft.Graph.Devices.CloudPrint | PSGallery 1.6.1 | Microsoft.Graph.Devices.Corporat... | PSGallery 1.6.0 | Microsoft.Graph.DirectoryObjects | PSGallery 1.6.1 | Microsoft.Graph.Education | PSGallery 1.6.1 | Microsoft.Graph.Files | PSGallery 1.6.0 | Microsoft.Graph.Financials | PSGallery 1.6.1 | Microsoft.Graph.Groups | PSGallery 1.6.1 | Microsoft.Graph.Identity.Directo... | PSGallery 1.6.1 | Microsoft.Graph.Identity.Governance | PSGallery 1.6.1 | Microsoft.Graph.Identity.SignIns | PSGallery 6.1907.1.0 | Microsoft.Graph.Intune | PSGallery 1.6.0 | Microsoft.Graph.Mail | PSGallery 1.6.0 | Microsoft.Graph.Notes | PSGallery 1.6.0 | Microsoft.Graph.People | PSGallery 1.6.0 | Microsoft.Graph.PersonalContacts | PSGallery 1.6.0 | Microsoft.Graph.Planner | PSGallery 1.6.0 | Microsoft.Graph.Reports | PSGallery 1.6.0 | Microsoft.Graph.SchemaExtensions | PSGallery 1.6.1 | Microsoft.Graph.Search | PSGallery 1.6.1 | Microsoft.Graph.Security | PSGallery 1.6.1 | Microsoft.Graph.Sites | PSGallery 1.6.1 | Microsoft.Graph.Teams | PSGallery 1.6.1 | Microsoft.Graph.Users | PSGallery 1.6.1 | Microsoft.Graph.Users.Actions | PSGallery 1.6.1 | Microsoft.Graph.Users.Functions | PSGallery 1.6.0 | Microsoft.Graph.WindowsUpdates | PSGallery 1.1.183.17 | MSOnline | PSGallery 1.4.7 | PackageManagement | PSGallery 2.2.5 | PowerShellGet | PSGallery 3.9.1905.3 | SharePointPnPPowerShellOnline | PSGallery

peombwa commented 2 years ago

@gouthambaskarn, please reach out to the authors of the module at https://github.com/microsoft/azureadexporter. The error implies that the module hasn't specified/installed/loaded our SDK as a dependency.

gouthambaskarn commented 2 years ago

@peombwa thank you for responding. However, that doesn't explain why I am not able to run Connect-MgGraph independently too?

Whenever I try connecting to MG Graph it says below

PS C:\Users\HIDDEN> Connect-MgGraph WARNING: Unable to find type [Microsoft.Graph.PowerShell.Authentication.Utilities.DependencyAssemblyResolver]. 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:1 char:1

ved-leachim commented 1 year ago

@gouthambaskarn I have exactly the same issue as you with the Connect-MgGraph in Azure Automation.