d365fo.tools is a PowerShell module that has a lot of useful commands to manage D365FO installation on your development environment. It simplifies and automates tasks that would otherwise require a lot of time and work. Full module description is available in this github repository.

Installation Link to heading

Run PowerShell as administrator and execute the following, answering ‘yes’ or ‘Y’ to all the prompts:

Install-Module -Name d365fo.tools

Commands Link to heading

The examples bellow are only few commands I find most useful. Here is a documentation for every available command.

Add rules to Windows Defender Link to heading

# This command excludes D365, SQL and X++ related processes
# from antivirus scanning to enhance performance during development
Add-D365WindowsDefenderRules

Start, stop, restart services Link to heading

Start-D365Environment -All
Stop-D365Environment -All
Restart-D365Environment -All

Enable/disable maintenance mode Link to heading

Enable-D365MaintenanceMode
Disable-D365MaintenanceMode

Install license Link to heading

Invoke-D365InstallLicense "C:\Temp\license.txt" -ShowOriginalProgress

Publish SSRS report Link to heading

# The command also supports wildcards (*) in the report name
Publish-D365SsrsReport -Module ApplicationSuite -ReportName TaxVatRegister.Report

Import model Link to heading

# -Replace parameter is optional
Import-D365Model -Path C:\temp\CustomModel.axmodel -Replace

Import tier 2 (PROD/UAT) database backup into dev environment Link to heading

# This needs to be run only once to install a SqlPackage tool needed to import bacpac
Invoke-D365InstallSqlPackage

# Import the database backup into 'AxDB_UAT'
Import-D365Bacpac -BacpacFile "J:\MSSQL_BACKUP\AxDB_UAT.bacpac" -ImportModeTier1 -NewDatabaseName AxDB_UAT -ShowOriginalProgress

# Stop the environment, replace AxDB with newly imported AxDB_UAT, 
# run db sync and start the environment
Stop-D365Environment -All
Switch-D365ActiveDatabase -NewDatabaseName "AxDB_UAT"
Invoke-D365DBSync -ShowOriginalProgress
Start-D365Environment -All

Manage users Link to heading

# Import
Import-D365AadUser -Users test@example.com
Import-D365ExternalUser -Id "test" -Name "Test User" -Email "test@ext.com" -Company "DEMF"

# Set Admin user (NOTE: also provisions the environment to 'example.com' AD tenant!)
Set-D365Admin "test@example.com"

# Enable all users (useful after DB restore)
Enable-D365User

# Enable specific user
Enable-D365User -Email "test@example.com"