'Do we need Active Directory Domain Controller to run any PowerShell commands?

I am trying to run a Powershell script which calls Get-ADUser command.
Something similar to this question Powershell Active Directory commands not working in Powershell session
But I am getting error Get-ADUser : Unable to find a default server with Active Directory Web Services running.

I have Imported the ActiveDirecotry Module and also run the Connect-AzureAD command.

Is it must to have the AD domain controller for running the Powershell commands?
Can we run Powershell commands like Get-ADUser just using the credentials of the Active Directory Admin?



Solution 1:[1]

Yes. The ActiveDirectory module cmdlets installed with RSAT Tools need to communicate with Active Directory infrastructure to retrieve information about the domain and objects stored within it.

This generally (if not wholly) encompasses other first-party PowerShell modules integrating with Active Directory services outside of ADDS as well; the services need to be communicable for the PowerShell modules to function correctly.


However, you have a fundamental misunderstanding of the differences between Active Directory and Azure AD. They are separate services and do not function the same way. At a high level:

  • Active Directory is the self-hosted on-prem directory services solution provided by Microsoft. This is the fully-functional AD you have known and loved since 1999.

    Generally administered with the RSAT Tools feature and the ActiveDirectory PowerShell module it installs.

  • Azure AD is a completely separate managed-directory service available from Microsoft in Azure. It does not provide anywhere close to a 1:1 feature parity with on-prem Active Directory. That isn't to say it is a lesser product; it is simply a different product.

    It is worth a mention that there are handy features available with Azure AD that you don't get with on-prem Active Directory. Generally administered via the Azure Portal, or the Az.* PowerShell modules available from the PowerShell Gallery.

You cannot use the ActiveDirectory module to manage Azure AD just as you cannot use the Az.* modules to manage on-prem Active Directory. You can have both modules installed on a single system of course, you just need to use the correct module with the correct service.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1