Azure Key Vault – The file type of the certificate to be imported must be .pfx or .pem

I was trying to import some existing certificates into Key Vault, using the Azure portal. All certificates were in PFX format and had a private key, but for some reason trying to import some of them was failing with the following error:

The file type of the certificate to be imported must be .pfx or .pem


https://user-images.githubusercontent.com/761098/55885240-e1f45e80-5ba9-11e9-92fd-cf45419efc64.png

After spending a couple of hours a colleague of mine suggested to change the file extension to lowercase, and guess what? It worked! The error message was not being displayed anymore:

https://user-images.githubusercontent.com/761098/55885507-5cbd7980-5baa-11e9-955e-ae584634f412.png

This is not the kind of bug I’d expect from the Microsoft guys, but hey they’re only human. Luckily I was able to find an easy workaround, otherwise I’d have to use Powershell or .NET code to import the certificate.

That’s it, happy coding! 🙂

Advertisements

On smoke tests

So you have configured a new build for your ASP.NET application: the source code compiles without errors, there are no unit tests failing, the deployment package is generated and published as an artifact – great! Now it’s time to deploy it. Everything seems to be fine (no errors logged), but when you try to run your application you get an YSOD like this one:

ysod1
There are many things that can go wrong with a deployment, so it is important to configure your deployment pipeline to verify that the deployment itself was successful. You can do it by using smoke tests.

Continue reading

Disabling ‘member is obsolete’ warnings on Visual Studio Team Services

The scenario – I am working on a new functionality solution that has many members marked as Obsolete (some are not being used at the moment and others will be removed in the future). When the solution is compiled warnings are being generated as follows:
01-vstudio-warnings

And this is how things are supposed to work – other developers working in the same solution will know straight away that these members should not be used. It’s perfectly fine to diplay these warnings locally, but honestly I don’t think it makes sense to display them on the build server.

MSbuild has a property named nowarn that can be used to suppress compiler warnings. In my case, I want to suppress warnings CS0612 (‘member’ is obsolete) and CS0618 (‘member’ is obsolete: ‘text’).

In VSTS add the following to the MSBuild arguments to your Visual Studio Build task:

/p:NoWarn=”612,618″

02-build-task.png

That’s it! No more ‘member’ is obsolete warnings will be displayed when running a new build. Remember to add the same arguments to other tasks that might use MSBuild (for example, I have another task that generates an ASP.NET deployment package which was generating the same warnings).

Happy coding!