Administrating Dynamics 365 F&O Local Business Data (LBD) is hard enough when you have one environment but when it is multiple environments and you want versatility in your scripts you are going to need help!

Fear not you can get the variables from various files from your "Orchestration" role servers, "Application" role Servers and file share. Luckily once you start grabbing one of the files on any of the servers with an LBD role (and knowing where to look) you can grab that info to find the rest of the information for the entire environment. The best part of this is if you are making automation you can run this using any server including the orchestrator servers making pre deployment and post deployment scripts super flexible (no hard-coding of environment variables in your scripts).

All the servers with service fabric installed has a ClusterManifest xml file that has the servers with which roles they have.

ClusterManifestXML example

If you are on an orchestration role server you can  grab from the Local Agent application has OrchestrationServicePkg.Package.Current.xml that has a plethera of environment variables including Orchestration Database server, agent share and the service fabric connection details.

How I like to read the xml and iterate the file I use PowerShell built in functionality (you can also read the values manually if you would like).

[xml]$XmlFileClusterConfig = Get-Content -Path "C:\ProgramData\SF\clusterManifest.xml"

$ReportServerServerIP = $($xml.ClusterManifest.Infrastructure.WindowsServer.NodeList.Node | Where-Object { $_.NodeTypeRef -contains 'ReportServerType' }).IPAddressOrFQDN

##This will put the Report Server IP address in the ReportServerServerIP variable

If you are on an application role server you can grab some more details the inside of the AX Application in the service fabric apps the AXSF.Package.Current.xml file. This has things such as AX database name, data connection, client URL

If you really want to be flexibility in your scripts and want to get some LCS details... you can grab the config.json file from the agent share. This includes tenantID, EnvironmentName, EnvironmentID.

How I like to read JSON files (ConvertFrom-Json being the key).

$ConfigFileJson = Get-Content \\share\wp\Config.json"

$LCSEnvironmentId = $($ConfigFileJson | ConvertFrom-Json).environmentid

## This will put the environmentID in the LCSEnvironmentId variable

Putting this all together...

I put all of the above into my function Get-D365LBDConfig to be used at the start of my pipeline scripts into a variable.


$Config = Get-D365LBDConfig -ComputerName "LBDOrchServerName"

Using the Get-D365LBDConfig function will help you automate your Dynamics 365 environments and not need to hardcode environment details in your pre or post deployment scripts.

Just give me the cheat sheet

The D365FOLBDAdmin Module has this function in it along with more functions to administrate your Local Business data environment(s) and can be downloaded on the PowerShell Module Gallery or on my GitHub page (GNU GPLv3 license).


Download from PowerShell Gallery


Download/Clone from Github