Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Install dotnet dev-certs certificate on a CI Server

I would like to run my API using dotnet run, so I can run some tests against it. However, on Azure Pipelines and AppVeyor, they don't have a developer certificate installed and I get an error when I try to start my API. Installing a developer certificate involes running:

dotnet dev-certs https --trust

However, this shows a dialogue which the user has to click and this fails the build. How can I install the developer certificate on a CI server?

like image 774
Muhammad Rehan Saeed Avatar asked Jul 26 '19 14:07

Muhammad Rehan Saeed


People also ask

What does dotnet dev certs do?

The dotnet dev-certs command manages a self-signed certificate to enable HTTPS use in local web app development. Its main functions are: Generating a certificate for use with HTTPS endpoints during development. Trusting the generated certificate on the local machine.

Can I configure my app to require a certificate only on certain paths?

Can I configure my app to require a certificate only on certain paths? This isn't possible. Remember the certificate exchange is done at the start of the HTTPS conversation, it's done by the server before the first request is received on that connection so it's not possible to scope based on any request fields.

What is configure for HTTPS Visual Studio?

When we create a web application with Visual Studio, we have an option to configure our application for HTTPS. When we create the application using CLI, by default, the web application configures for HTTPS. Using the following command, we can turn off HTTPS.

How do I get a DotNet certificate manually?

You can either use your own certificate (aspnet core listenOptions.UseHttps (new X509Certificate2 (...));) in your app or export the dotnet dev certificate with: dotnet dev-certs https --export-path <path> [--password <pass>] This generates the certificate that you need. You can trust this certificate manually with powershell as explained here:

How do I install a certificate on my IIS server?

On the IIS Manager at the server level, locate the “Server Certificates” icon and double-click it Locate the “Actions” pane on the ride side and click “Import” Provide the .pfx file full path, password for the keys and click OK. This will install the certificate for you. You must be a registered user to add a comment.

What is the DotNet Dev-Certs command?

The dotnet dev-certs command manages a self-signed certificate to enable HTTPS use in local web app development. Its main functions are: Generating a certificate for use with HTTPS endpoints during development. Trusting the generated certificate on the local machine. Removing the generated certificate from the local machine.

How to install SSL certificate on Windows Server 2016?

How to install SSL certificate on the Windows Server. Login to your server with the Username and Password. Select the Server name in the left window pane. Double click on Server Certificates in the right window pane. Click on Certificate Service Request. Fill the details in the request certificate. Click on Next


1 Answers

You can either use your own certificate (aspnet core listenOptions.UseHttps(new X509Certificate2(...));) in your app or export the dotnet dev certificate with:

dotnet dev-certs https --export-path <path> [--password <pass>]

This generates the certificate that you need. You can trust this certificate manually with powershell as explained here:

https://stackoverflow.com/a/49444664/1216595 or https://stackoverflow.com/a/21001534/1216595

like image 70
cyptus Avatar answered Oct 08 '22 19:10

cyptus