question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Describe the bug

I would like to run my API using dotnet run, so I can run some tests against it on my CI server. 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?

My scenario is that I want to run functional tests against my dotnet new project templates by actually running them. Here is an example of my unit test:

public async Task Run_HealthCheckFalse_Successful()
{
    using (var tempDirectory = TemplateAssert.GetTempDirectory())
    {
        var project = await tempDirectory.DotnetNew(
            "api",
            "HealthCheckFalse",
            new Dictionary<string, string>() { { "health-check", "false" } });
        await project.DotnetRestore();
        await project.DotnetBuild();
        await project.DotnetRun(
            @"Source\HealthCheckFalse",
            async httpClient =>
            {
                var statusResponse = await httpClient.GetAsync("status");
                Assert.Equal(HttpStatusCode.NotFound, statusResponse.StatusCode);
            });
    }
}

Expected behavior

I should be able to install the dev certificate without UI. I expected the --quiet flag to do this but that was not the case.

Screenshots

This is the dialog that appears on Windows:

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

0reactions
blowdartcommented, Jul 29, 2019

Local Machine would, I believe, prompt a dialog too. As I said earlier we wouldn’t ever provide a non-prompting version

And yes, you can export the certificate from a dev machine and install it into the stores on the CI machine, then also trust it and away you go. Or just run the dev-certs command on the CI machine itself interactively and confirm the trust dialog

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet dev-certs command - .NET CLI
The dotnet dev-certs command generates a self-signed certificate to enable HTTPS use in development.
Read more >
How to Install dotnet dev-certs certificate on a CI Server
You can either use your own certificate (aspnet core listenOptions.UseHttps(new X509Certificate2(...)); ) in your app or export the dotnet ...
Read more >
How to Install dotnet dev-certs certificate on a CI Server
Describe the bug I would like to run my API using dotnet run, so I can run some tests against it on my...
Read more >
Generate Self-Signed Certificates Overview - .NET
This article covers using self-signed certificates with dotnet dev-certs , and other options like PowerShell and OpenSSL .
Read more >
Getting ASP.NET Core dev certs working in both WSL and ...
This is fairly easy to get set up using the dotnet dev-certs tool. ... I needed to build an IdP using Identity Server,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found