Terraform provisioner remote-exec fails with error: 'Failed to upload script: RROR: SFTP failure'

I am having trouble with deploying an Azure ‘azurerm_linux_virtual_machine’ resource that has provisioner remote-exec in it.
The deployment works fine with out it but once i add it i get an error:
‘Failed to upload script: RROR: SFTP failure’

At first i thought it was connection error and maybe the inbound rules blocked or something an ssh connection but no, i used telnet, winscp with sftp and it all worked fine on the created vm. The vm does get deployed but the command from the provisioner fails.

any ideas how to fix this problem?