D365 CRM: How to get the connection string of your CRM Organization stored in an Azure Key Vault



  • It is a good practice for security purpose to store in an Azure Key Vault your credentials and/or connections to the different system such as the D365 CRM connection string. Here I will share a portion of code to retrieve a Secret stored in an Azure Key Vault, for example a Connection String to use in the CRM API.
    Important Note: You will need for this a Client ID and a Secret Key generated to authenticate to the Key Vault.
    -First of all, create in your Azure Key Vault a Secret that contains your connection string of CRM.

     

    -Take a note of your Client ID, Secret Key, Vault URI, and the Secret Name created in the previous step.
    -Use the following code to get the Secret value of the Key Vault:

     

    This will return the secret value stored in that Key Vault Secret, in this case the connection string to connect to the CRM API.

    Enjoy it!
     


  • Comments



Add a Comment