When adding a custom Enterprise Certificate to an Azure App Service, you need to ensure that the certificate contains extendedKeyUsage attribute of serverAuth. This post aims to describe the steps required to do this. First it is assumed that a Linux VM is being to install and configure Enterprise Root CA and subsequent certificates are signed by this CA.
The steps for creating a root CA and generating a Certificate Signing Request is documented here. Follow these steps to get root CA up and running and to generate a Certificate Signing Request.
Next create a text file with .cnf extension that contains the extendedKeyUsage attribute of serverAuth, a sample is shown below and assume this is named myopenssl.cnf
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
[req_distinguished_name]
countryName = SG
stateOrProvinceName = Singapore
localityName = CityHall
organizationName = NTUC
commonName = ntucapp1.azfasttrack.com
[v3_req]
extendedKeyUsage = serverAuth
Here using -extensions flag to reference the code block within the .cnf file that contains the extendedKeyUsage, in this case it is v3_req
openssl x509 -req -in mycsr.csr -CA myrootca.crt -CAkey myrootca.key -CAcreateserial -out mysignedcert.crt -days 365 -sha256 -extfile myopenssl.cnf -extensions v3_req
openssl x509 -in mysignedcert.crt -text
openssl pkcs12 -export -inkey mycert.key -in mysignedcert.crt -out mysignedcert.pfx