# How to connect Ansible to Windows VM via Azure managed identity

**URL:** <https://forum.ansible.com/t/how-to-connect-ansible-to-windows-vm-via-azure-managed-identity/40581>\
**Category:** Get Help\
**Tags:** azure, windows\
**Created:** [February 24, 2025, 3:59am UTC](https://forum.ansible.com/t/how-to-connect-ansible-to-windows-vm-via-azure-managed-identity/40581 "2025-02-24T03:59:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maheswar26](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@maheswar26](https://forum.ansible.com/u/maheswar26)\
**Post date:** [February 24, 2025, 3:59am UTC](https://forum.ansible.com/t/how-to-connect-ansible-to-windows-vm-via-azure-managed-identity/40581/1 "2025-02-24T03:59:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![iwt-cmd](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iwt-cmd/32/9120_2.png) [@iwt-cmd](https://forum.ansible.com/u/iwt-cmd)\
**Post date:** [February 24, 2025, 1:22pm UTC](https://forum.ansible.com/t/how-to-connect-ansible-to-windows-vm-via-azure-managed-identity/40581/2 "2025-02-24T13:22:39Z")

</div>

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](https://ansible.readthedocs.io/projects/awx/en/24.6.1/userguide/credentials.html#microsoft-azure-resource-manager)

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

---

<div class="post-metadata">

**Author:** ![maheswar26](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@maheswar26](https://forum.ansible.com/u/maheswar26)\
**Post date:** [February 25, 2025, 8:03am UTC](https://forum.ansible.com/t/how-to-connect-ansible-to-windows-vm-via-azure-managed-identity/40581/3 "2025-02-25T08:03:02Z")

</div>

Hi Joe,

Thanks for sharing the doc, trying with managed identity was a try.

for Windows ssh, my usecase is very limited. i want to install packages via Ansible and Windows SSH working good sofar.
