web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Environment Variables and Plugins?

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • ashlega Profile Picture
    34,477 on at

    You might try using secure/unsecure config:

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

  • Community Member Profile Picture
    on at

    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.

  • Verified answer
    ashlega Profile Picture
    34,477 on at

    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)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans