Skip to content

Installation

Niels Steenbeek edited this page Dec 13, 2023 · 44 revisions

Installation

Command

npm install -g @hso/d365-cli

Prerequisites

Node

Node is the Node Package Manager used by the projects to install JavaScript/TypeScript packages

ESLint

When using Visual Studio Code as IDE, have Visual Studio Code ESLint plugin installed. The projects have an ESLint Configuration to lint/validate the code build and compile time. The ESLint plugin is for build time.

Fiddler

Fiddler Classic is recommended for debugging. It is a proxy and will serve local files instead of server files. Fiddler needs some settings in general and rules for every project. See Debugging for adding rules.

Installing Fiddler Classic may be hard, since you need to pass some registration. To easy this, you can use Chocolately.

choco install fiddler

Fiddler settings:

  • Start Fiddler and click 'Tools' and 'Options...'

  • Click 'HTTPS' tab

    • Select 'Capture HTTPS CONNECTs', 'Decrypt HTTPS traffic', 'Ignore server certificate errors (unsafe)
    • Select '...from browsers only' in dropdown
    • In 'Skip descryption for the following hosts:' add *.microsoft.com; *.microsoftonline.com; *.live.com; *.office.net;
    • FiddlerHttps
  • Click 'Connections' tab

    • Select 'Reuse client connections', 'Reuse server connections', 'Act as system proxy on startup', 'Monitor all connections', 'DefaultLAN'
    • In 'Bypass Fiddler for URLs that start with:' add <-loopback>; *office.net; *office365.com; *live.com; *.microsoft.com; *.microsoftonline.com;
    • FiddlerConnections

Configure Visual Studio Code

Running the CLI commands in Visual Studio Code will give an error, since PowerShell by default restricts running scripts unless the execution policy is changed. This can be done by following steps:

  1. Open Visual Studio Code
  2. Press ctrl + shift + p)
  3. Type "settings.json" and select option 'Preferences: Open Settings (JSON)' to edit the settings.json
  4. Add following part inside the brackets
"terminal.integrated.profiles.windows": {
  "PowerShell": {
    "source": "PowerShell",
    "icon": "terminal-powershell",
    "args": ["-ExecutionPolicy", "Bypass"]
  }
},
"terminal.integrated.defaultProfile.windows": "PowerShell",

Make sure you make this change in the Global and not in your own workspace.

Configure Application Registration

By default the project uses an Application Registration provided by HSO, which is multi-tenant and will be fine for most projects. If an IT department does not allow that, they have to create an Application Registration in their own tenant and the project needs the clientId and Redirect url:

  1. In Azure Active Directory create an Application Registration
  2. In API Permissions assign Dynamics CRM (user_imporsonate)
  3. In Authentication switch on both 'Access tokens (used for implicit flows)' and 'ID tokens (used for implicit and hybrid flows)'
  4. Set Redirect url equal to the project tools/crm.json/adal/redirectUri
  5. Copy client Id and put in the project tools/crm.json (adal/clientId)