Today I needed to make a web service call with authentication from MsBuild. Of course storing the credentials in plain text is not an option.

The Windows Credential Manager User Interface can be opened by running the command:

control /name Microsoft.CredentialManager

There is also a command line interface:

cmdkey.exe

As the Windows APIs are not provided as wrapper through the Base Class Library (BCL) a NuGet package comes to help:

nuget.exe install CredentialManagement

Finally everything wrapped up in a MsBuild Task: