Using Azure Managed Identity with .Net Core on Azure DevOps Agents

During my last project I needed to run some integration test written in .Net Core 2.2 in an Azure Devops Pipeline.

The code needed some secrets from an Azure KeyVault and doing some other stuff on other Azure Resources using Azure Managed Identities for authentication on them.

In .Net Core you can easily accomplish this using the AppAuthentication Nuget library.

Here an example how to use this library for getting secrets etc.. from the KeyVault.

To run this code you need an Azure infrastructure where Managed Identities is enabled, like a VM, Azure Web App/Function App etc….

So, how can you run this code on Azure DevOps agents?

Continue reading “Using Azure Managed Identity with .Net Core on Azure DevOps Agents”

Solve “System.Threading.Tasks.TaskCanceledException : The operation was canceled. ” on Ubuntu 18.04 in .Net Core 2.2

I am running some .Net Core 2.2 (at the moment of writing version 2.2.301) integration test in Azure DevOps (ADO) running on my private Linux Ubuntu 18.04 agents.
The tests are quiet simple, just call an internally exposed Rest API through Azure API Management.
Because the APIM is running internally the endpoint are using self-signed SSL certificates generated with an internal Root Certificate.

During the runs in ADO I was experiencing the following error:

Error Message:
   System.Threading.Tasks.TaskCanceledException : The operation was canceled.
  Stack Trace:
     at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
Continue reading “Solve “System.Threading.Tasks.TaskCanceledException : The operation was canceled. ” on Ubuntu 18.04 in .Net Core 2.2″

Demystifying .NET Core SDK versions

Last night I was developing some code in .NET Core for the Dutch Azure Meetup and I was (again) encountering versioning problems and unexpected behavior.

I found this blog post which describes in some way the same problem I had.

Update 13-01-2017: I found this blog which also describes very well the issue.

What the blog post says is that if you use:

dotnet new

and you want use a specific version of .NET Core SDK you should add a global.json file (before executing the “dotnet new” command) like this:

 "sdk": {
 "version": "1.0.0-preview2-003121"

The SDK’s in Windows are installed in the Program Files folder (or Program Files (x86) if you have a 32bit Windows) so let’s take a look there:

The following SDK’s are installed om my machine:

    • 1.0.0-preview2-003131
    • 1.0.0-preview2-003133
    • 1.0.0-preview2-003156
    • 1.0.0-preview4-004233
  • 1.0.0-preview2-1-003177

But how I know which SDK belongs to which .NET Core version? Continue reading “Demystifying .NET Core SDK versions”

Solve 401 (Unauthorized) error when restoring packages using VSTS Package Management and .NET Core

For the quick answer jump directly to the conclusion

Yesterday I was setting up the build for an ASP .NET Core (Web API) application I wrote, this application was using a package from the VSTS Package Management repository.

To setup this build I was using the new dotnet Core tooling (in preview) which is available when creating a new Build Definition:


Continue reading “Solve 401 (Unauthorized) error when restoring packages using VSTS Package Management and .NET Core”

Blog at

Up ↑