How to - Azure Automation - Runbook - Active Directory Powershell cmdlets ?

%3CLINGO-SUB%20id%3D%22lingo-sub-285159%22%20slang%3D%22en-US%22%3EHow%20to%20-%20Azure%20Automation%20-%20Runbook%20-%20Active%20Directory%20Powershell%20cmdlets%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-285159%22%20slang%3D%22en-US%22%3E%3CP%3EHow%20do%20run%20the%20Get-ADUser%20Active%20Directory%20powershell%20cmdlet%20within%20an%20Azure%20automation%20runbook%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENot%20all%20our%20AD%20objects%20are%20synced%20to%20Azure%20AD%20and%20there%20is%20a%20requirement%20to%20query%20on-premise%20AD%20from%20an%20Azure%20automation%20runbook.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EError%3A%3C%2FP%3E%3CP%3E%3CEM%3EThe%20term%20'Get-ADUser'%20is%20not%20recognized%20as%20the%20name%20of%20a%20cmdlet%2C%20function%2C%20script%20file%2C%20or%20operable%20program.%20Check%20the%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Espelling%20of%20the%20name%2C%20or%20if%20a%20path%20was%20included%2C%20verify%20that%20the%20path%20is%20correct%20%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Eand%20try%20again.%3C%2FEM%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-285159%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAutomation%20%26amp%3B%20Control%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-285296%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20-%20Azure%20Automation%20-%20Runbook%20-%20Active%20Directory%20Powershell%20cmdlets%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-285296%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%205.1.%26nbsp%3B%20I%20also%20installed%20any%20modules%20the%20runbook%20will%20need%20on%20the%20Hybrid%20Worker.%20%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-285232%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20-%20Azure%20Automation%20-%20Runbook%20-%20Active%20Directory%20Powershell%20cmdlets%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-285232%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Dominic%2C%3C%2FP%3E%0A%3CP%3Ewhich%20version%20PS%20you%20have%3F%3C%2FP%3E%0A%3CP%3Elast%20version%205.1%3F%3C%2FP%3E%0A%3CP%3ECheers%3C%2FP%3E%0A%3CP%3EFabrizio%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-285160%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20-%20Azure%20Automation%20-%20Runbook%20-%20Active%20Directory%20Powershell%20cmdlets%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-285160%22%20slang%3D%22en-US%22%3E%3CP%3ETake%20a%20look%20at%20Azure%20Automation%20Hybrid%20Workers%20to%20run%20the%20runbook%20in%20your%20domain.%20I%20did%20a%20video%20on%20setting%20one%20up%20located%20here.%20%26nbsp%3B%26nbsp%3B%3CA%20href%3D%22http%3A%2F%2Fwww.ciraltos.com%2Fazure-automation-hybrid-worker-setup-and-runas-account%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fwww.ciraltos.com%2Fazure-automation-hybrid-worker-setup-and-runas-account%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

How do run the Get-ADUser Active Directory powershell cmdlet within an Azure automation runbook ?

 

Not all our AD objects are synced to Azure AD and there is a requirement to query on-premise AD from an Azure automation runbook.

 

Error:

The term 'Get-ADUser' 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.

3 Replies

Take a look at Azure Automation Hybrid Workers to run the runbook in your domain. I did a video on setting one up located here.   http://www.ciraltos.com/azure-automation-hybrid-worker-setup-and-runas-account/

 

Hi Dominic,

which version PS you have?

last version 5.1?

Cheers

Fabrizio

Yes, 5.1.  I also installed any modules the runbook will need on the Hybrid Worker.