Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Environment Variables and Plugins?

Posted on by Microsoft Employee

Hi there,

I am working on a combination of a plugin, endpoint, and JavaScript in order to encrypt and decrypt custom fields on two entities. My understanding is that the correct way to do this is to encrypt with a plugin on the Create or Load messages, then use JavaScript to decrypt onLoad (which will call a C# WebAPI endpoint to retrieve the decrypted value).

However, I have a problem. I don't want to check the encryption cipher and passphrase into version control -- I want to store them as environment variables. I can do this in C# and WebAPI, but is there an equivalent for CRM that the plugin can access? Can I set something on the PluginExecutionContext ahead of time that it can access? I understand that plug-ins are meant to be stateless so I can't pass something into the constructor function.

Any guidance or ideas would be greatly appreciated.

Cheers,

Sam

*This post is locked for comments

  • Verified answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Environment Variables and Plugins?

    If not the secure config, you can always store some values in a dedicated configuration entity(will need to create one).. but you'll have to query it from the plugin, so it's less efficient.

    You might create a process to automatically update those plugin steps (a custom workflow activity might help with that)

    Either way, you won't be able to use environment variables for this (or some kind of pre-set plugin execution context)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Environment Variables and Plugins?

    I looked at that, but it would mean that every step in which the plugin is used would need the exact same XML pasted in, and it could be edited at some point by anyone with admin access. It would be better if there was an environment variable that could be set by the sysadmin and never touched again.

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Environment Variables and Plugins?

    You might try using secure/unsecure config:

    blogs.msdn.microsoft.com/.../storing-configuration-data-for-microsoft-dynamics-crm-plug-ins

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans