In Microsoft Dynamics 365 finance and operations, Entity store is database (AxDW) which you can use in D365 FO POWER BI dashboards for realtime analytical reporting . Click here to read more about entity store.
What is Azure Data Lake ?
Microsoft Azure Data Lake is cloud based storage and analytics service . Azure Data lake allows data scientist and data engineer to store any kind of large data and performing analytics, machine learning & AI operations on it. Click here to read more about entity store.
Quick Steps Exporting Entity Store in Azure Data Lake
Deploy a new storage account in azure portal. Don,t forget to mention Account kind as StorageV2. Most important, in Advance TAB Enable the Hierarchical namespaces feature else you will not be able to consume Azure Data Lake data in Power BI.
When the deployment is completed, go to your recently deployed storage account and navigate to Settings –> Access Keys . Note down the connection string value, it will be used in coming steps
Deploy a KEY VAULT resource in portal.azure.com as per your comfort.
After deployment of key vault , go to your Azure KEY VAULT resource and navigate to Settings — > Secrets.
Click on button + GENERATE/IMPORT & create a SECRET. Fill a name for the secret and not it somewhere as NAME will be used in next steps. In the VALUE Field please Enter the connection string i (connection string you obtained from previous steps inside STORAGE ACCOUNTS)
Secret KEY is created
Go to Azure portal, select Azure Active Directory, and then select App registrations. You need to register an App
After registering you APP, navigate to –>API permission and Configured permissions as mentioned below.
In your registered APP, navigate to –> Certificates & secrets. Generate a new client secret and copy it immediately somewhere.
Now go back to your KEY VAULT Resource and click on access polices.
In the Select principal field, select the name of the application that you previously registered.In the Key permissions field, select Get and List permissions.In the Secret permissions field, select Get and List permissions.
Now open your D365 finance and operations environment and go the SYSTEM PARAMETERS . Fill the below details
Application ID: Enter the application ID of the Azure AD application that you registered earlier.
Application Secret: Enter the application key (secret) for the Azure AD application.
DNS name: Enter the DNS name of Key Vault.
Secret name: Enter the name of the secret that you added to Key Vault together with connection string information.
Validate and Test AZURE KEY VAULT as well as AZURE DATA STORAGE
Refresh Entity Store
Now your entity store is available in Azure Data Lake.
There are some scenarios in Microsoft Dynamics 365 finance and operations where we need to run X++ program or code or business operation on the behalf of different userId other than current userId.
In my case, my X++ program of D365 finance and operations should always run under the userId- ADMIN . I can use ‘RunAs’ function & method in Dynamics 365 Finance & Operations.
Sample Code:
class AcxSharepointIntegeration
{
public static container download(container _parms)
{
RunAsPermission perm;
perm = new RunAsPermission("Admin");
perm.assert();
Container returncontainer = runAs("Admin", classnum(AcxSharepointIntegeration), "get", _parms);
CodeAccessPermission::revertAssert();
return returncontainer;
}
public static container get(container _parms)
{
container con;
// Your business Logic
return con;
}
class AcxSharepointIntegeration { public static container download(container _parms) { RunAsPermission perm; perm = new RunAsPermission(“Admin”); perm.assert(); Container returncontainer = runAs(“Admin”, classnum(AcxSharepointIntegeration), “get”, _parms); CodeAccessPermission::revertAssert(); return returncontainer; }
public static container get(container _parms) { container con; // Your business Logic return con; }
Uploading a file in Sharepoint online using X++ and inside from Microsoft Dynamics 365 finance and operations.
Prerequisites:
The current user id of Microsoft Dynamics 365 Finance and operations should have proper rights and privileged in Sharepoint Online.
Sample Code:
In this scenario i am creating a text file in Microsoft Dynamics 365 finance and operations and then uploading its memory Stream in Sharepoint online using X++ . You can modify the X++ code in D365 finance and operations as per your need.
class RunnableClassRun { /// /// Runs the class with the specified arguments. /// /// The specified arguments. public static void main(Args _args) { System.UriBuilder builder = new System.UriBuilder(“https://XXXXXX.sharepoint.com”); str extId = xUserInfo::getExternalId(); Microsoft.Dynamics.AX.Framework.FileManagement.SharePointDocumentStorageProvider provider; Microsoft.Dynamics.AX.Framework.FileManagement.DocumentLocation documentLocation = new Microsoft.Dynamics.AX.Framework.FileManagement.DocumentLocation(); provider = new Microsoft.Dynamics.AX.Framework.FileManagement.SharePointDocumentStorageProvider(“XXXXXX.sharepoint.com”, “sites/dummy”, “Shared%20Documents/MyFolder”, extId); System.Byte[] reportBytes = new System.Byte[0](); System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); reportBytes = enc.GetBytes(“YOUR STRING/TEXT”); System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(reportBytes); //memoryStream = comma.getStream(); documentLocation = provider.SaveFile(newGuid(), ‘TextFile.txt’, System.Web.MimeMapping::GetMimeMapping(‘TextFile.txt’), memoryStream); }
Microsoft Dynamics AX, Microsoft Dynamics 365 for Finance and Operations, D365 FO, Retail, SQL, Microsoft Power Apps, Microsoft Power BI, Microsoft Azure, Logic Apps, Microsoft Flow, Microsoft power automate, Microsoft Power Platform,.Net, X++, C#, Power BI DAX, Data Warehousing, Microsoft Analysis Services, SQL Server Reporting Services