0

I have pfx certificate. I need to add FriendlyName to Pfx certificate and then add certificate to Webapp using azure cloud shell.

Using following script, you can set friendlyName,

$cert= Get-PfxCertificate -FilePath "XYZ\XYZC.pfx" | SELECT *   
$cert.FriendlyName = "XXXTest"

But then this $cert cannot be used for uploading certificate with friendlyName. Following script is for adding certificate to Webapp.

New-AzWebAppSSLBinding -ResourceGroupName "resourceName" -WebAppName "webAppName" -CertificateFilePath "XYZ\XYZC.pfx" -CertificatePassword "XXXX" -Name "webAppName"

Is there a way to set friendlyName before uploading to webapp. Appreciate for help.

Jahnavi
  • 3,076
  • 1
  • 3
  • 10
Chhaya
  • 5
  • 2

1 Answers1

0

To set friendly Name before uploading to webapp:

As -FriendlyName flag is existed in the New-SelfSignedCertificate. You can add a friendly Name to the certificate as it is being created itself.

$params = @{
    DnsName = 'www.xxxx.com'
    CertStoreLocation = 'Cert:\path\Mydir'
    FriendlyName = 'jahtest'
}
$cert =New-SelfSignedCertificate @params
Export-PfxCertificate -Cert $cert -FilePath "C:\Desktop\mynewcert.cer" -Password (ConvertTo-SecureString -String "xxxxxx" -Force -AsPlainText)
$certdata= Get-PfxCertificate -FilePath "C:\Users\v-majahnavi\Desktop\mynewcert.cer" | SELECT *
$certdata.FriendlyName = "jahtest"

enter image description here

enter image description here

New-AzWebAppSSLBinding -CertificateFilePath xxxx -CertificatePassword xxxxx -Name 'xxxx.azurewebsites.net' -ResourceGroupName '<ResourceGroup>' -SslState Disabled -WebAppName '<WebApp>'

Uploaded successfully:

enter image description here

Jahnavi
  • 3,076
  • 1
  • 3
  • 10
  • This is something different. No need to create pfx. Actually I have the PFX file and I have to use the same to upload in webapp with FriendlyName. – Chhaya Jul 20 '23 at 13:14
  • As you already given, You can set the friendly name to the cert data and upload it. It will upload with the friendly name. That is the only way of achieving it. @Chhaya – Jahnavi Jul 21 '23 at 05:54