Is it possible to create AD Users (and generally run AD cmdlets) with Custom Script Extension on Azure machines?
I see that CSE is running as SYSTEM. It also doesn't start any scripts that I am trying to run as a different user, e.g.
#try1
Start-Process Powershell.exe -ArgumentList C:\MyScript.ps1 -Credential $VMcred
#try2
$farmSession = New-PSSession -Credential $VMcred -ComputerName $env:computername
Invoke-Command -Session $farmSession -Script `
{ #MyScriptHere}
Is the solution to assign AD permissions to a SYSTEM account?
Or PSRemoting is a must in this case?