D365FO - Setting Up Azure Key Vault Client
Manish Moothedath
Digital Architect, Microsoft platform & Business applications (Dynamics 365, Power Platform, Azure)
The Key Vault client may not be a widely recognized feature in D365FO, but when I implemented it for a customer, I discovered it to be straightforward and beneficial. However, a significant drawback is that Key Vault parameters are saved per-company rather than as a global application configuration. To use identical parameters across different legal entities, you must either replicate the parameters for each legal entity or develop a custom method within your model to access secrets across legal entities.
A key application of the key vault client is in custom integrations with external applications, where it securely stores credentials and connectivity parameters in an Azure key vault. These can then be accessed within D365FO using standard X++ code. D365FO already includes all required classes and libraries to retrieve secret values from the Azure key vault, requiring only minimal configuration to get started.
Here’s a high-level overview of how the components interact:
Here’s a simplified representation of the architecture:
To set up the Azure Key Vault client in your D365FO application, you would typically:
领英推荐
Now that you have configured the key vault client in D365FO, you can access the secret in your X++ code easily.
Here's a sample code to pass the secret name (as configured in the "Name" column in the key vault parameters screen) to one of the standard methods and get the secret value based on that record. There are more methods available in KeyVaultCertificateTable & KeyVaultCertificateHelper class for use as per your requirement.
sample code:
Assuming, you will keep setups for each connection parameter for your integration. just pass each secret name to the method for retrieving their values.
secret 1 = myClass::getSecretValue(secretname);
public static str getSecretValue(str _name)
{
KeyVaultCertificateTable certTable = KeyVaultCertificateTable::findByName(_name);
return KeyVaultCertificateHelper::getManualSecretValue(certTable.RecId);
}
MS Dynamics AX & D365FO - Technical Consultant
8 个月How we can get secret value from ERKeyVaultCertificateTable & ERKeyVaultParameters table?