Friday, 29 May 2020

Configure Power BI Embedded in Dynamics 365 for Finance and Operations (One-box environment)


By default, Power BI Embedded will be available only in UAT & Production boxes.
Showcasing to the customers in Demo or Presales system would be challenging.
Follow the below steps to enable the same in Demo environment as well.

  1. Create new SQL Server in Azure Portal, as shown below. Add Server admin login as axdbadmin and provide the password from the LCS Demo environment full details. Create new Database "AxDW" with the default settings


2. Create a Deploy a custom template


JSON StringUse the scrip as is, we can replace the below highlighted value and the same name will be used while generating access keys.
{ "$schema""https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion""1.0.0.0", "parameters": {}, "resources": [ { "type""Microsoft.PowerBI/workspaceCollections", "sku": { "name""S1", "tier""Standard" }, "name""DEVPBI", "apiVersion""2016-01-29", "location""North Europe" } ] }
  1. Login to the Demo Box and Run below commands in PowerShell (e.g. ISE) as an administrator:

    set-executionpolicy remotesigned
    Install-Module -Name Az -AllowClobber
    Import-Module Az.PowerBIEmbedded
    Connect-AzAccount

    Use below command, if you have multi tenant liked to your account
    Connect-AzAccount -Tenant
    *****.onmicrosoft.com
  1. Access Keys: Run below command to get Access keys
    Get-AzPowerBIWorkspaceCollectionAccessKey ResourceGroupName "ResourceGroupName" WorkspaceCollectionName "DEVPBI".
    The ResourceGroupName assigned to the SQL Sever at the time of creation in the 1st step.
  1. Create below users in newly created Azure SQL Server, along with their passwords specified in the LCS for the Demo box enviornment.
    'axdwadmin’ and ‘axdwruntimeuser’

    GO CREATE LOGIN [axdwadmin] WITH PASSWORD=N'******'
    GO CREATE LOGIN [axdwruntimeuser] WITH PASSWORD=N'******'


  2.  Add above users to AxDW Database, which we created newly in Azure SQL Server and assign the roles.

    CREATE USER axdwadmin FROM LOGIN axdwadmin;CREATE USER axdwruntimeuser FROM LOGIN axdwruntimeuser;

    ALTER ROLE db_owner ADD MEMBER axdwadmin;
    ALTER ROLE db_datareader ADD MEMBER axdwru
    ntimeuser;
  3. Update web.config file with latest PowerBI access keys, which we get from Step 4.
    Search for BiReporting.DWServer  and replace the value with newly created azure sql server name
    <add key="BiReporting.DWServer" value="****.database.windows.net"/>
    Add the below lines before the </appSettings>
    <add key="PowerBIEmbedded.AccessKey" value="Access key 1" />
    <add key="PowerBIEmbedded.AccessKey2" value="Access key 2" />
    <add key="PowerBIEmbedded.ApiUrl” value="https://api.powerbi.com" />

    <add key="PowerBIEmbedded.IsPowerBIEmbeddedEnabled" value="true" />
    <add key="PowerBIEmbedded.WorkspaceCollectionName" value="DEVPBI" />
  4. Restart IIS and D365FO Batch Services.

  5. To test Embedded PowerBI is working:

    Refresh any entity Store in the application.
    Verify structure and records got pushed to newly created AxDW database, by seeing the related Measures and Views.
    Go the the relavent entity store workspace and click on Analytics tab.
    We should be able to see the PowerBI Reports.

    Sometimes we may get error saying that, “Failed to publish Power BI Embedded report ****BIReport.”
    Resolution: Add public IP address of the Demo box to the newly created Azure SQL Server, in Firewall and virtual networks.
     

Hope this content helps you to configure PowerBI Embedded in your Demo or Development boxes..