Issue with pfx file certificate uploading

Olumese AnthonyAbieba 25 Reputation points
2023-01-31T23:15:33.7533333+00:00

I am trying to create a runbook
How do I use self signed certificate properly to create a connection
what I have so far
$certname = "tokentest6"    ## Replace {certificateName}
$cert = New-SelfSignedCertificate -Subject "CN=$certname" -CertStoreLocation "Cert:\CurrentUser\My" -KeyExportPolicy Exportable -KeySpec Signature -KeyLength 2048 -KeyAlgorithm RSA -HashAlgorithm SHA256
$mypwd = ConvertTo-SecureString -String "*t%2313173373A&&&&" -Force -AsPlainText  ## Replace {myPassword}
Export-PfxCertificate -Cert $cert -FilePath "C:$certname.pfx" -Password $mypwd   ## Specify your preferred location

The cert.pfx was created using powershell on my windows 11 pc

When I am uploading the .pfx file to azure, it pops up with an error
"An error occurred while creating the certificate 'tokenpfx' Error details: The specified network password is not correct."

Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
926 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,111 questions
0 comments No comments
{count} vote

Accepted answer
  1. Peter T 326 Reputation points
    2023-02-03T17:58:02.47+00:00

    Hi,

    I think the password itself is at fault. PowerShell allows you to export the certificate with a password containing special characters while this might cause unexpected behavior on other portals.

    I would suggest attempting to use a different password for exporting the .pfx file, and looking out for the backtick " ` " character as usually this is the culprit.

    BR,

    Peter

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. AnuragSingh-MSFT 19,686 Reputation points
    2023-02-02T13:35:16.71+00:00

    @Olumese AnthonyAbieba thank you for posting this question.

    I used the script mentioned in the question to create a self-signed certificate and exported it. When uploading it to Azure Automation account, I was able to use the same password as mentioned in the script to upload it successfully.

    I think, you are trying to use the double-quotes ("") along with the password, after copying it from the script, as the certificate password because of which you would get the error as mentioned in the question: User's image

    Use the password without double-quotes, to successfully upload it to Azure Automation Certificates.

    Please let me know if you have any questions.