author | ms.service | ms.subservice | ms.topic | ms.date | ms.author |
---|---|---|---|---|---|
kengaderdus |
active-directory-b2c |
B2C |
include |
11/12/2021 |
kengaderdus |
If you don't already have a certificate, you can use a self-signed certificate. A self-signed certificate is a security certificate that is not signed by a certificate authority (CA) and doesn't provide the security guarantees of a certificate signed by a CA.
On Windows, use the New-SelfSignedCertificate cmdlet in PowerShell to generate a certificate.
-
Run the following PowerShell command to generate a self-signed certificate. Modify the
-Subject
argument as appropriate for your application and Azure AD B2C tenant name such ascontosowebapp.contoso.onmicrosoft.com
. You can also adjust the-NotAfter
date to specify a different expiration for the certificate.New-SelfSignedCertificate ` -KeyExportPolicy Exportable ` -Subject "CN=yourappname.yourtenant.onmicrosoft.com" ` -KeyAlgorithm RSA ` -KeyLength 2048 ` -KeyUsage DigitalSignature ` -NotAfter (Get-Date).AddMonths(12) ` -CertStoreLocation "Cert:\CurrentUser\My"
-
On Windows computer, search for and select Manage user certificates
-
Under Certificates - Current User, select Personal > Certificates>yourappname.yourtenant.onmicrosoft.com.
-
Select the certificate, and then select Action > All Tasks > Export.
-
Select Next > Yes, export the private key > Next.
-
Accept the defaults for Export File Format, and then select Next.
-
Enable Password option, enter a password for the certificate, and then select Next.
-
To specify a location to save your certificate, select Browse and navigate to a directory of your choice.
-
On the Save As window, enter a File name, and then select Save.
-
Select Next>Finish.
For Azure AD B2C to accept the .pfx file password, the password must be encrypted with the TripleDES-SHA1 option in the Windows Certificate Store Export utility, as opposed to AES256-SHA256.
On macOS, use Certificate Assistant in Keychain Access to generate a certificate.
- Follow the instructions for how to create self-signed certificates in Keychain Access on a Mac.
- In the Keychain Access app on your Mac, select the certificate that you created.
- Select File > Export Items.
- Select a file name to save your certificate. For example: self-signed-certificate.p12.
- For File Format, select Personal Information Exchange (.p12).
- Select Save.
- Enter a password in the Password and Verify boxes.
- Replace the file extension to .pfx. For example: self-signed-certificate.pfx.