"Certificate does not contain any CA certificate" error when I create a SSL profile on Azure Application Gateway

Mohsen Akhavan 936 Reputation points
2022-10-31T11:09:06.563+00:00

Let me explain more about the scenario.
I have a web application that is hosted on an Azure App Service Plan.
I created two certificates "Root" and "Child" with the blow command:

Generate root cert:    
$pwd = ConvertTo-SecureString -String "123" -Force -AsPlainText    
$filepath = 'C:\Users\Desktop\certificates\'    
$rootcert = New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My -Subject "IdentityServerCN"-Provider "Microsoft Strong Cryptographic Provider"-HashAlgorithm "SHA512"-NotAfter (Get-Date).AddYears(5) -KeyUsageProperty All -KeyUsage CertSign, CRLSign, DigitalSignature    
Export-PfxCertificate -cert ('Cert:\LocalMachine\My\' + $rootcert.thumbprint) -FilePath ($filepath+'IdentityServerCertificate.pfx')  -Password $pwd    
    
     
Generate child cert:    
$pwd = ConvertTo-SecureString -String "123" -Force -AsPlainText    
$scope = "app"    
$env = "develoepr"    
$filepath = 'C:\Users\Desktop\certificates\test\'    
$certname = $scope + "_"+ $env    
$childcert = New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My -Subject "IdentityServerCN"-Provider "Microsoft Strong Cryptographic Provider"-HashAlgorithm "SHA512"-NotAfter (Get-Date).AddYears(5) -Signer $rootcert  -FriendlyName $certname     
Export-PfxCertificate -cert ('Cert:\LocalMachine\My\' + $childcert.thumbprint) -FilePath ($filepath + $certname+'.pfx') -Password $pwd    

When I directly open the web app URL https://app-test-platform.azurewebsites.net/index.html the application request a certificate. I selecet the child certificate and then the application opened.

255623-image.png

255691-image.png

Now, I want to move this app behind the Azure Application Gateway and I configure all settings (backend, listeners and etc). Based on this document for this solution I need SSL Profile. First of all, I need to export the trusted CA certificate chain (this document). I have done all steps and when I back to Application Gateway and created an SSL profile I received this error when I want to upload *.cer files.

Failed to save configuration changes to application gateway 'XXXX'. Error: TrustedClientCertificate XXXX/providers/Microsoft.Network/applicationGateways/XXXX/trustedClientCertificates/XXX'>XXXX/XXX does not contain any CA certificate. A CA certificate contains the basic constraint extension with subject type as CA.    

255609-image.png

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
965 questions
Azure Web Application Firewall
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,963 questions
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 35,986 Reputation points Microsoft Employee
    2022-11-21T13:30:53.733+00:00

    Hi @Mohsen Akhavan ,

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.
    From your verbatim, I understand you are trying to configure mutual authentication for your application.

    From initial analysis, it appears that this is not a CA certificate
    The below command should help you create a CA certificate

    Root:
    $cert = New-SelfSignedCertificate -Type Custom -KeySpec Signature -Subject "CN=MutualAuthRoot" -KeyExportPolicy Exportable -HashAlgorithm sha256 -KeyLength 2048 -TextExtension @("2.5.29.19={text}CA=true") -CertStoreLocation "Cert:\CurrentUser\My" -KeyUsageProperty Sign -KeyUsage CertSign

    Client:
    New-SelfSignedCertificate -Type Custom -DnsName MutualAuthLeaf -KeySpec Signature -Subject "CN=MutualAuthLeaf" -KeyExportPolicy Exportable -HashAlgorithm sha256 -KeyLength 2048 -CertStoreLocation "Cert:\CurrentUser\My" -Signer $cert -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.2")

    You informed that you are now able to resolve your issue.

    Cheers,
    Kapil

    ----------------------------------------------------------------------------------------------------------------

    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.

    0 comments No comments

0 additional answers

Sort by: Most helpful