# When I use azure module , I saw "PEM\_read\_bio:no start line:pem\_lib.c:703:Expecting: TRUSTED CERTIFICATE"

**URL:** <https://forum.ansible.com/t/when-i-use-azure-module-i-saw-pem-read-bio-no-start-line-pem-lib-cexpecting-trusted-certificate/19451>\
**Category:** Ansible Project\
**Tags:** azure\
**Created:** [October 7, 2015, 8:00am UTC](https://forum.ansible.com/t/when-i-use-azure-module-i-saw-pem-read-bio-no-start-line-pem-lib-cexpecting-trusted-certificate/19451 "2015-10-07T08:00:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Takeshi\_Kuramochi](https://avatars.discourse-cdn.com/v4/letter/t/e8c25b/32.png) [@Takeshi\_Kuramochi](https://forum.ansible.com/u/Takeshi_Kuramochi)\
**Post date:** [October 7, 2015, 8:00am UTC](https://forum.ansible.com/t/when-i-use-azure-module-i-saw-pem-read-bio-no-start-line-pem-lib-cexpecting-trusted-certificate/19451/1 "2015-10-07T08:00:29Z")

</div>

Hi all,

- Ansible 2.0.0 alpha 2
- azure python module 1.0.2
- python 2.7.6

Also, I try to use #2114 because it has exists issue(#2014).

# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.pem -out mycert.pem

# openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer

I have already upload “mycert.cer” file to my management portal.

My playbook below;

- hosts: localhost  
gather\_facts: no

user: vagrant  
sudo: yes

tasks:

- name: Create Virtual Machine on Azure (for Linux)  
tags: azure\_linux  
azure:  
auto\_updates: no  
endpoints: “22”  
hostname: tkstudio  
image: ‘b39f27a8b8c64d52b05eac6a62ebad85\_\_Ubuntu-14\_04\_3-LTS-amd64-server-20150908-en-us-30GB’  
location: ‘Japan West’  
name: myhostname  
management\_cert\_path: /home/vagrant/azure/mycert.pem  
os\_type: linux  
user: azureuser  
password: “mypassword”  
reset\_pass\_atlogon: no  
role\_size: Basic\_A0  
ssh\_cert\_path: /home/vagrant/azure/ssh\_key/cloud-key.pub  
state: present  
storage\_account:   
subscription\_id:   
virtual\_network\_name:  
wait: no  
wait\_timeout: 600  
wait\_timeout\_redirects: 300

I saw error messages when I run a playbook to create vm with ansible azure module.

ESTABLISH LOCAL CONNECTION FOR USER: vagrant  
127.0.0.1 EXEC (umask 22 && mkdir -p “$HOME/.ansible/tmp/ansible-tmp-1444202389.06-143864791731356” && echo “$HOME/.ansible/tmp/ansible-tmp-1444202389.06-143864791731356”)  
127.0.0.1 PUT /tmp/tmp0jR7IG TO /home/vagrant/.ansible/tmp/ansible-tmp-1444202389.06-143864791731356/azure  
127.0.0.1 EXEC /bin/sh -c ‘sudo -H -n -S -u root /bin/sh -c ‘"’“‘echo BECOME-SUCCESS-ojpvbfrddrrghbiuzpisxjjqbdatkyfq; LANG=C LC\_MESSAGES=C LC\_CTYPE=C /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1444202389.06-143864791731356/azure; rm -rf “/home/vagrant/.ansible/tmp/ansible-tmp-1444202389.06-143864791731356/” \> /dev/null 2\>&1’”’"‘’  
fatal: [127.0.0.1]: FAILED! =\> {“changed”: false, “failed”: true, “msg”: “failed to generate the key fingerprint, error was: unable to load certificate\n139986364962464:error:0906D06C:PEM routines:PEM\_read\_bio:no start line:pem\_lib.c:703:Expecting: TRUSTED CERTIFICATE\n”}

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

I cannot solute this problem yet, any ideas?

Regards,  
Takeshi.K
