Glad to see that my earlier suggestion to use the Azure Key Vault-generated certificate as the Root Certificate for your Point-to-Site VPN helped. Note that the reason this does not work, even when you set all the key usage flags, is due to how Azure Key Vault certificates are structured and managed.
For one, Azure Key Vault generates certificates as end-entity certificates by default. Even if you configure key usage correctly, certificates generated via Azure Key Vault’s built-in certificate creation often lack the explicit Certificate Authority (CA) bit, which is required for a root certificate. Windows requires a Root CA to have the correct extensions (Basic Constraints: CA=True
) for it to sign client certificates.
In addition, Key Vault does not directly issue CA-signed certificates. It is primarily designed for managing certificates issued by public or private Certificate Authorities (CAs), rather than acting as a CA itself. Even if you enable keyCertSign, it may not fully meet the P2S VPN requirements.
To work around this, you can try either of the following two options
Option 1: Manually create and import a CA-Signed root certificate into Key Vault
Instead of generating the root certificate within Key Vault, you can:
- Manually create a self-signed root certificate on a local machine using PowerShell or OpenSSL.
- Ensure the certificate has the
CA=True
extension (Basic Constraints: Subject Type = CA
). - Upload the manually created root certificate into Key Vault for storage and management.
- Use this root certificate to generate client certificates (which you can also store in Key Vault).
Steps to Manually Generate a Valid CA Root Cert
# Generate a self-signed root CA certificate
$rootCert = New-SelfSignedCertificate -Type Custom `
-KeyUsageProperty Sign -KeyUsage CertSign `
-Subject "CN=VisibleFarm Root CA" `
-KeyExportPolicy Exportable `
-HashAlgorithm SHA256 `
-Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" `
-CertStoreLocation "Cert:\CurrentUser\My" `
-NotAfter (Get-Date).AddYears(5)
# Export the certificate to a file (without private key for VPN Gateway)
Export-Certificate -Cert $rootCert -FilePath "C:\Temp\VFDevRootCert.cer"
# Export as PFX for Key Vault (including private key for internal usage)
Export-PfxCertificate -Cert $rootCert -FilePath "C:\Temp\VFDevRootCert.pfx" -Password (ConvertTo-SecureString -String "YourStrongPassword" -Force -AsPlainText)
- Upload
VFDevRootCert.cer
to the VPN Gateway (as the Root Certificate). - Upload
VFDevRootCert.pfx
to Key Vault to manage its lifecycle and allow developers to generate client certificates from it.
Option 2: Use an external CA (recommended for enterprise scenarios)
- Instead of using Azure Key Vault to generate a Root Certificate, you can use a trusted internal PKI (Active Directory Certificate Services, Let's Encrypt, or a commercial CA like DigiCert).
- Upload the trusted CA certificate into Azure Key Vault and reference it for issuing client certificates.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin