I will be creating a C# console app that will be executed by a windows task. The purpose of this console app is to prepare a JSON file for bulk user profile update.

what is the best way to store SPO Admin credentials that will upload the file to Office 365 Tenant?


Windows Credential Manager is one option. Another option would be to use a file or registry and use DPAPI.

There are lots of examples out there, so don't take the above as the absolute only way to work with these technologies.


I'm curious to see other answers, but I personally found this post: https://stackoverflow.com/questions/12657792/how-to-securely-save-username-password-local

and ended up using this method from Jon Galloway,


it uses DPAPI, already mentioned by Trevor. the key is attached to the user/machine so it will not work in other users/machines (you can request it initially, and then schedule)

the credential manager option looks great, so I don't know. you can have a look at both and see which one is better for your scenario.


Have you considered using Azure Automation and Runbooks? You can store the credentials in Automation Account Credential store.

  • No, I haven't but feel free to share some links. Thanks! – Aslan Mar 7 '19 at 21:40
  • "Sending you a link" won't help. You have to learn how to use Runbooks and change the way you are running your integration. The PowerShell may be similar but it depends on where/how you are getting your data. Adding credentials is trivial after you get the rest working. – Matthew McDermott Mar 8 '19 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.