# Cannot provision VM in Azure using Ansible

**URL:** <https://forum.ansible.com/t/cannot-provision-vm-in-azure-using-ansible/27123>\
**Category:** Ansible Project\
**Tags:** azure\
**Created:** [March 27, 2018, 6:44am UTC](https://forum.ansible.com/t/cannot-provision-vm-in-azure-using-ansible/27123 "2018-03-27T06:44:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cloudworld79](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@cloudworld79](https://forum.ansible.com/u/cloudworld79)\
**Post date:** [March 27, 2018, 6:44am UTC](https://forum.ansible.com/t/cannot-provision-vm-in-azure-using-ansible/27123/1 "2018-03-27T06:44:39Z")

</div>

Team,

Trying to provision VM in Azure Environment using Ansible.  
However, getting error while running the command -

$ sudo ansible-playbook azure\_create\_vm.yml

PLAY [Create Azure VM] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost]

TASK [Create VM] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [localhost]: FAILED! =\> {“changed”: false, “msg”: “Error creating or updating virtual machine myVM1 - Azure Error: InvalidParameter\nMessage: Destination path for SSH public keys is currently limited to its default value /home/ansibleubuntu\_admin/.ssh/authorized\_keys due to a known issue in Linux provisioning agent.\nTarget: linuxConfiguration.ssh.publicKeys.path”}  
to retry, use: --limit @/home/ansibleubuntu\_admin/azure\_create\_vm.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
localhost : ok=1 changed=0 unreachable=0 failed=1

I`ve followed the Ansible article to create the credentials.ini and stored the SSH keys.  
Wondering what steps to perform to check if any mistake with SSH key.

Please find my azure\_create\_vm.yml file for details.

$ vim azure\_create\_vm.yml

- name: Create Azure VM  
hosts: localhost  
connection: local  
tasks:
- name: Create VM  
azure\_rm\_virtualmachine:  
resource\_group: ansible  
name: myVM1  
vm\_size: Standard\_B2s  
admin\_username: ansibleubuntu\_admin  
ssh\_password\_enabled: false  
ssh\_public\_keys:
- path: /home/ansibleubuntu\_admin/.ssh/id\_rsa.pub  
key\_data: “ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHlUSOoRcz6ZbQsqIz2Q/vAW6VspvWLounnV4S3c2yTJpK9iHUkcp4oc6Nev4vna84P5BrisDjOkDvnv4eVfCVqB7SYUxGlHdnGi6nnwkLhx6kVZalRi0opdSYDkfk1/q1TCUaLDJp/cErMH/8ItLEJlWsSHuo/ccbkRaKBPvSGJPEKMqmzEJFjTjeUg9MJU3/4EC+NGvLVuoxMrt00WrcdERthVAnAgkbnxIhfbv9+PdjeeCzpWu7SOsHiXQr52xnrLX4VKcEiAXtwYa02kZYcv11ERkjyq7sCiNdcNK+9BXuAgcDcAHV2eXd3NE/qyKfxvTWaHk2esTlwMiH3zsd”  
image:  
offer: UbuntuServer  
publisher: Canonical  
sku: ‘16.04-LTS’

Any pointer will be deeply appreciated.
