Hi @Mounika Ponnam ,
Welcome to Microsoft Q&A! Apologies for the delayed response.
Automation requires the certificate to have the provider Microsoft Enhanced RSA and AES Cryptographic Provider. I went through the links shared in the question but I could not find the exact command used to create the certificate to verify it. The link here has a detailed description of the steps involved. I even tested a test certificate created based on the PowerShell script available in this link and was able to upload the certificate successfully to the Azure Automation Account.
The snippet below when run in PowerShell will
1. Create a Certificate with the required provider
2. Import it to the Computer's MY store.
3. Exports the certificate with Public Key with a .cer extension to the provided directory. This certificate can be uploaded to the Automation account.
Source: Create an Azure Automation account on using Portal PowerShell and AzureCLI
$automationAccount = 'AutomationAccountName'
$certExpiryMonths = 24
$certPfxPassword = '123456'
$certExportPath = 'D:\Data\certificate'
$resourceGroup = 'azAutomation-rg'
$location = "East Us"
$certPassword = ConvertTo-SecureString $certPfxPassword -AsPlainText -Force
#Generate SSL certificate
Write-Host "Generate self signed certificate for - $automationAccount"
$selfSignedCertSplat = @{
DnsName = $automationAccount
Subject = $automationAccount
CertStoreLocation = 'cert:\CurrentUser\My'
KeyExportPolicy = 'Exportable'
Provider = 'Microsoft Enhanced RSA and AES Cryptographic Provider'
NotAfter = (Get-Date).AddMonths($certExpiryMonths)
HashAlgorithm = 'SHA256'
}
$selfSignedCert = New-SelfSignedCertificate @selfSignedCertSplat
#Export SSL certificate to file
Write-Host "Export self signed certificate to folder - $certExportPath"
$certThumbPrint = 'cert:\CurrentUser\My\' + $selfSignedCert.Thumbprint
Export-Certificate -Cert $certThumbPrint -FilePath "$certExportPath\$automationAccount.cer" -Type CERT | Write-Verbose
Please let me know if you have any questions.
---
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.