Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 9146

How can I automate the connection to an On Prem Windows VM that uses Azure AAD for authentication?

$
0
0

My requirement is to automate the transfer of files, and running commands on the Windows VM, which is currently a manual process where I log in to the VM via RDP (and it prompts me for my username/password of my account).

I have been doing a bit of digging on this, as I am able to automate the same thing for a Linux VM where no such AAD based authentication exists and I use the paramiko library to transfer content from my PC to the VM and run bash commands.

client = paramiko.SSHClient()client.set_missing_host_key_policy(paramiko.AutoAddPolicy())# Connect to the servertry:    client.connect(host, username=username, password=password)    # Initialize the SFTP client    sftp = client.open_sftp()    # Transfer the file    sftp.put(local_file_path, remote_file_path)    print(f"File {local_file_path} has been transferred to {remote_file_path} on the remote server.")    _stdin, _stdout,_stderr = client.exec_command("ls random*")

(Omitted content for brevity and confidentiality)

However, getting a set of credentials to log in to the Windows VM isn't allowed as per the org policy.

I am not really able to find any online resources on the same, beyond this and this but in the latter, it seems all be related to a simpler scenario where there is a username/password combination. I am investigating the usage of Pywinauto to try this out, but I am still not really sure on what the best approach really is. Personally, I would prefer to use Python but I am amenable to any solution at this point (or at least being pointed in the right direction).


Viewing all articles
Browse latest Browse all 9146

Trending Articles