Manage AD user accounts with AWS Lambda

Has anyone had any luck using AWS Lambda functions to manage AD user accounts? I know I can build a lambda function and use the aws powershellcore tools and aws.tools.common but I’m not able to import the Active directory module when building the function/layer. As an alternative I was thinking maybe I could run an invoke-function from Lambda into a windows member server or even a Domain controller for running something like set-aduser then pass in the user info as an object. Having the AD module in the lamba would be great

How about implicit remoting?

Using PowerShell implicit remoting – 4sysops

For example:

$session = New-PSSession -ComputerName DC01
invoke-command -Session $session -ScriptBlock { Import-Module activedirectory }
Export-PSSession -Session $session -CommandName *get* -OutputModule RemAD -AllowClobber

# Verify
Import-Module RemAD
get-command -Module remad

You could then use for example ‘Get-ADComputer’ and it would implicitly remote.

I wrote a blog post about it as well: PowerShell implicit remoting - by Adrian Muscat

Any feedback or improvements welcome.

Welcome to the community btw :grinning: