Problem with windows and poetry


I am willing to create an AMI (aws image) using the amazon-ebs builder.

I am trying to install poetry and configure a private repository. At that time it returns :
(1312, ‘CredRead’, ‘A specified logon session does not exist. It may already have been terminated.’)

Then poetry is unable to pull the packages from the private repository.

If I connect to the VM just before the command line and execute the same command, everything works like a charm.

I was wondering what is the difference in term of script execution for WinRM (does not work) vs RDP (works) ?

After one day of trying I posted the message above. I just found the solution. Using elevated_user and elevated_password in the configuration of the powershell provisionner fix the problem (care, the pwd is changed to c:\windows\system32)