password errors importing windows ssl certificate

9 views
Skip to first unread message

John Veliss

unread,
Dec 9, 2022, 1:58:19 PM12/9/22
to Ansible Project
I am trying to import a certificate using both 

1. win_certificate_store
 - name: Import certificate be used by IIS
    win_certificate_store:
      path: c:\temp\SDCW.abc.com.pfx
      password: test01
      state: present
      file_type: pkcs12
      store_location: LocalMachine
      store_name: My
      key_storage: machine
      key_exportable: yes
    become: yes
    become_method: runas
    become_user: SYSTEM

2. win_shell + Import-PfxCertificate
 - name: Import certificate to be used by IIS, using win_shell (powershell)
    win_shell: |
      $securePassword = "test01"
      $mypwd = ConvertTo-SecureString -String $securePassword -Force -AsPlainText
      $certFilePath = "c:\temp\SDCW.abc.com.pfx"
      Import-PfxCertificate -FilePath $certFilePath -CertStoreLocation cert:\LocalMachine\My -Exportable -Password $mypwd

Both ways always give me errors relating to password

The specified network password is not correct

I am able to run the above PS script locally on my local computer and import the cert successfully, so I know the password is correct.

If anyone has any ideas, it would be appreciated.

Thanks


Reply all
Reply to author
Forward
0 new messages