How to connect Ansible to Windows VM via Azure managed identity

Hi,

at present im trying to do the deployment in Windows VM’s via ansible and the connection is happening via SSH with specific ansible user credentials.

Is there a way to connect Ansible to Windows VM via Managed identity?.

this is my host file at the moment with dedicated user credentials.

[windows]
xx.xx.xx.xx

[windows:vars]
ansible_user=ansible user
ansible_password=virtualmachine passowrd
ansible_connection=ssh
ansible_shell_type=cmd
ansible_ssh_common_args=-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
ansible_ssh_retries=3
ansible_become_method=runas

Hi Mahesh,

I’m assuming you’re using Azure. The issue you’re going to run into is that a Managed Identity is used for Azure control plane authentication (ARM), not OS authentication. There is a Microsoft Azure Resource Manager credential type if you’re in AWX but that will take in either username/password or App Registration and secret (not Managed Identity).

10. Credentials — Ansible AWX community documentation

On a side note, I am curious how your experience has been with using SSH to Windows. My understanding was that there were limitations with the modules and the support was somewhat experimental. WinRM has been a bane of my existence but it looked like SSH on Windows was going to just be a difference headache.

Best regards,

Joe