Can not do a "net ads join" inside custom script when I'm trying to deploy a SLES 12 Server on Azure

I use a custom script to configure my SLES 12 SP3 Server after an Azure deployment. I use waagent to execute this script.

The first step of my script is to register my new server to my on-premise SUSE MANAGER server. Everything works and I got my channels UP, I can download and install packages.

The second step is to integrate my new server to our on-premise Active Directory. To do this I use the net command : "net ads join".

The output of this command is : "Failed to join domain: Not enough storage is available to process this command."

If I use the same command by my hand after the deployment it works.

I did a "df -h" before and after the "net ads join" command but there is a free space.

I do not know why it's not working with my custom script. When I use the --debuglevel=10 for the net command I can see this: WERR_NOT_ENOUGH_MEMORY

I tried to execute another script to do the AD integration at the end of the customization but it's not working and I got the same error. If I execute this script after the deployement everything is going well.

The content of my json file :

"commandToExecute": "[concat('sh \"', parameters('customUri'), '\" \"' , parameters('HanaVersion'), '\" \"' , parameters('vmUserName'), '\" \"', parameters('vmPassword'),'\" \"', parameters('HANASID'), '\" \"', parameters('HANANUMBER'), '\" \"', parameters('vmSize'), '\" \"', parameters('domainUserName'), '\" \"', parameters('domainPassword'), '\"')]"

My shell script :

I store the password and the username in the following variable :



Firstable, I do a kinit : echo -n "$ADPWD" | kinit $ADUSR

And I use my ticket to join the domain :

net ads join osname="$osname" osVersion="$osVersion" osServicePack="$osServicePack" --no-dns-updates -k createcomputer=$organizationalUnit

Thank you