Self Signed Certificate – PowerShell Code Snippet

How to create self signed TLS/SSL certificate? $cert = New-SelfSignedCertificate -CertStoreLocation cert:\currentuser\my -Subject “cn=asish.azure-api.net” -DnsName “rwf-npd.azure-api.net”$pwd = ConvertTo-SecureString -String ‘YourPassword’ -Force -AsPlainText$path = ‘cert:\currentuser\my\’ + $cert.thumbprintExport-PfxCertificate -cert $path -FilePath c:\test\powershellcert.pfx -Password $pwd Relevant for Azure API Management

How to convert .pfx to .cer?

openssl pkcs12 -in testcert.pfx -out C:\TLS\powershellcert.pem -nodes openssl pkcs12 -in testcert.pfx -nocerts -out [keyfilename-encrypted.key] Download and install openssl from https://slproweb.com/products/Win32OpenSSL.html

How to validate jwt token from Azure AD B2C in Azure API Management (APIM)?

<validate-jwt header-name=”Authorization” failed-validation-httpcode=”401″ failed-validation-error-message=”Unauthorized. Access token is missing or invalid.”> <openid-config url=”https://xxxx.b2clogin.com/xxxx.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_SIGNUP_SIGNIN” /> <audiences> <audience>b33b3ba3-c921-4599-b648-57e9c5e023f</audience> </audiences> <issuers> <issuer>https://xxxx.b2clogin.com/a135e382-58b6-4d1e-8d7e-7323faa57809/v2.0/</issuer> </issuers> </validate-jwt>