# vault-encrypted admin\_password issues in azure\_rm\_virtualmachine module

**URL:** <https://forum.ansible.com/t/vault-encrypted-admin-password-issues-in-azure-rm-virtualmachine-module/26985>\
**Category:** Ansible Project\
**Tags:** azure, windows\
**Created:** [March 13, 2018, 3:23pm UTC](https://forum.ansible.com/t/vault-encrypted-admin-password-issues-in-azure-rm-virtualmachine-module/26985 "2018-03-13T15:23:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Pilon](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Alex\_Pilon](https://forum.ansible.com/u/Alex_Pilon)\
**Post date:** [March 13, 2018, 3:23pm UTC](https://forum.ansible.com/t/vault-encrypted-admin-password-issues-in-azure-rm-virtualmachine-module/26985/1 "2018-03-13T15:23:32Z")

</div>

Hello,

Having an issue here.

I created a role with variables both stored in the role’s /vars folder, and in a /group\_vars’ encrypted vault.  
The variables in the encrypted vault are for username and password when creating/accessing Windows servers.

Using azure\_rm\_virtualmachine, I wanted to create a new VM. It creates fine with no errors, but once I try to RDP into it, it doesn’t accept the password from the vault. The only way for me to access the server is to manually go in Azure’s GUI and reset the password, with the same password from the vault, and then it works.

The password contains only letters and numbers, no special characters.

Here’s the appropriate role code:

`

---

<div class="post-metadata">

**Author:** ![Alex\_Pilon](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Alex\_Pilon](https://forum.ansible.com/u/Alex_Pilon)\
**Post date:** [March 14, 2018, 10:41pm UTC](https://forum.ansible.com/t/vault-encrypted-admin-password-issues-in-azure-rm-virtualmachine-module/26985/2 "2018-03-14T22:41:08Z")

</div>

bump.

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [March 14, 2018, 10:46pm UTC](https://forum.ansible.com/t/vault-encrypted-admin-password-issues-in-azure-rm-virtualmachine-module/26985/3 "2018-03-14T22:46:42Z")

</div>

2 things you can try;

- Run ` **- debug: var=vault_cloud_windows_admin_password** ` before the task and make sure the password is what you expect
- Just write the password as a string to the module task instead of sourcing from a variable

The first thing tells you the correct variable is being sourced from vault and is what you expect. The second thing let’s you know whether there may be a bug in the module as you are explicitly telling what one to use.

---

<div class="post-metadata">

**Author:** ![Alex\_Pilon](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Alex\_Pilon](https://forum.ansible.com/u/Alex_Pilon)\
**Post date:** [March 20, 2018, 7:58pm UTC](https://forum.ansible.com/t/vault-encrypted-admin-password-issues-in-azure-rm-virtualmachine-module/26985/4 "2018-03-20T19:58:08Z")

</div>

Hey Jordan,

Thanks for the answer, and sorry for my delay. Weekend, AWX setup and other things got in the way of me trying this out.

Did your suggestions. The first one returned the proper value, so that’s a good sign.  
Did the second one: Worked fine as well, which confused me.  
I removed the literal password string, re-configured the vault variable while leaving the debug task there, and tried again…and it worked.

I’m thoroughly confused as to why it now works, but hey, I won’t complain haha

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [March 20, 2018, 11:04pm UTC](https://forum.ansible.com/t/vault-encrypted-admin-password-issues-in-azure-rm-virtualmachine-module/26985/5 "2018-03-20T23:04:31Z")

</div>

No worries, glad it worked out in the end and wasn’t a bug in the module.
