2
PS C:\Windows\system32> get-module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     5.1.2      azure                               {Add-AzureAccount, Add-AzureApplicationGatewaySslCertifica...
Script     4.2.1      Azure.Storage                       {Disable-AzureStorageDeleteRetentionPolicy, Enable-AzureSt...
Binary     2.0.1.16   AzureAD                             {Add-AzureADApplicationOwner, Add-AzureADDeviceRegisteredO...
Script     4.6.0      AzureRM.Profile                     {Add-AzureRmEnvironment, Clear-AzureRmContext, Clear-Azure...
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PS...

In my windows Powershell, I am able to use Connect-AzureAd cmdlet. Now I want to use this in my C# application, so I need to import a module that is connected with Connect-AzureAd.

But I listed the modules, I want to import the correct module. Even I worked with all the .psd1 file my Connect-AzureAd command is not recognized.

So, Give me a proper solution, Thanks in advance

Robert Dyjas
  • 4,979
  • 3
  • 19
  • 34
saravanan ks
  • 133
  • 1
  • 12
  • why duplicate, I'm asking about which module – saravanan ks Jul 03 '18 at 12:39
  • Why would you use Powershell command from C# instead of the C# SDK ? – Steve B Jul 03 '18 at 12:40
  • want to run PowerShell cmdlets in C#, using `System.Management.Automation.Runspaces`; – saravanan ks Jul 03 '18 at 12:42
  • You asked how to import a module. You do that with `ImportPSModule`. If you want to find which module provides a command just [check its documentation](https://learn.microsoft.com/en-us/powershell/module/azuread/connect-azuread?view=azureadps-2.0). Or check the contents of the `ExportedCommands` that appears in the results you posted. – Panagiotis Kanavos Jul 03 '18 at 13:18
  • In any case, something called [Connect-AzureAD](https://learn.microsoft.com/en-us/powershell/module/azuread/connect-azuread?view=azureadps-2.0) will almost certainly be found in the `AzureAD` module. – Panagiotis Kanavos Jul 03 '18 at 13:19

0 Answers0