C/Side – Design Patterns Master Class for Microsoft Dynamics NAV – Part II

Anuncios

Business Central “Ready to use” Microsoft Flow Templates

Original URL...

“Ready to use” Flow templates for Business Central are increasing, keep an eye to Microsoft Flow Site to keep up-to-date on the new available templates. It is also possible to propose own templates to Microsoft, if they are valid and interesting they could be published.

Developing Business Central Extensions/Apps in Team

Original URL…

I picked up a new challenge these days: for one of our (quite big) customers, we need to develop a solution, based on extensions. In short: ready for the future, easy to upgrade. When I would explain the case in a paragraph, you’d say “this is not NAV”, although when you would really look deep into it, it’s ideal for an Extension-scenario, obviously in combination with Business Central.

The project

In short, let’s define the project like this:

  • Multiple extensions to be made:
    • A W1 Base Extensions with shared functionality and frameworks
    • For each country (like Belgium) a separate extension, specifically for local functionality
  • The timespan is 2 years
  • We are working with 5 developers at the same time on this project, spread over 3 countries. Good developers, which means not really infrastructural-minded.
  • Test Driven development in an agile approach

So, one project, multiple extensions, multiple developers spread over multiple countries (not time zones, luckily), dependencies, different symbols (W1 and BE), … .

Why this blogpost?

Well, we came to the conclusion that “developing an extension” is one thing. One app, usually one developer, some local development environment, it’s all very manageable. But when you try to do development in team – it’s a whole different story. And we have faced (and still facing) quite some points that need attention. You will see this is a train of thoughts – not a complete list – and not all points I have answers to. More than enough reasons to write some follow-up posts in the future ;-).

So why this post? Just to share my experience in this story, and may be also to get feedback from this great community we have ;-). Any feedback is always appreciated – the community is here to make everyone and the product better!

The focus of this post is not on “how to develop in team”, but rather “what I think we need to take into consideration when you do”.

CI/CD

If you have never heard about “Continuous Integration”, “Continuous Delivery” and/or “Continuous Deployment” – now it’s time to dive into it :-). It’s a mature way of handling software these days – and very new for our precious NAV world. Let it be no doubt, also I realize there is no way to work in team without a decent implementation of CI/CD, so we have set up a system that automated quite a lot.

  • GIT with a remote in VSTS takes care of our “continuous integration” of the code of team members.
  • Branch for each “unit of work”
  • We have a master-branch-policy, which means we work with pullrequests to pull changes of our team members in the master branch by build definitions – which also forces us to review the code.
  • These build definitions do quite a lot (analyze, compile, test-deploy, manage manifest, …)
  • We have release pipelines to get our stuff to test-environments (continuous delivery/deployment)

And a lot more – part of which I will address in the upcoming points. Again, this is not about CI/CD, but you’ll see that the concept solves a lot of points, but also introduces some other challenges.

Object Numbers

A challenge you’ll face quite soon is “how to manage object numbers”. As a team, each member has his branch, within his branch, he will start creating tables, codeunits, … . But if you just use that awesome “auto numbering” that comes out of the box with the al-language .. you’ll end up with the same object numbers when you start merging your branch. Compile errors will cause many builds to fail!

You can’t just change the app.json to influence the autonumbering, because things will not compile in a while.

So, in a way, you need to abandon the nice autonumbering, and go into assigning object numbers to people/branches/workitems.

We created a dashboard app to manage all the things (we think) can’t be managed by VSTS – which also includes object numbers and field numbers.

“I need that field you are creating – can you save your object?”

I was a big fan of a central development database. Besides the fact you couldn’t develop in one object with multiple developers at the same time, it mostly had advantages. So easy. At all time, you had an overview of all developments everyone was creating.

Well, I guess I need to grow up now, because now, we are not developing in a database, we are developing in files, distributed on local systems/branches, integrated by VSTS .

So, if you need a field (or any piece of development for that matter) that was created in another branch, but not pushed to master just yet? Well, there are two ways – you start merging the two branches (which I wouldn’t do in a million years) – or you pull the change to master, so the other branch can merge with master, and continue development with those needed fields.

Does the field already exist?

An extra challenge which is quite similar to the above is the fact you don’t have an actual overview of all fields that are being created. Basically a list for all fields, for all tables, for all branches in development.

As said, we are being agile, so for functional and technical people, it’s very nice to be able to check who/what/.. Fields are already created that you can use in the next sprint.. . You can’t just open a table and see what fields are there – there might be some in extension objects – even not pushed to master yet.

We will create a dedicated functionality to “push” our fields from all branches to our dashboard so that we always have a nice up-to-date list to filter and analyse the fields we have at hand ;-).

Breaking schema changes during development phase

You’d say – during development, schema is not important. If you want to delete a field, just delete it. In the world of extensions these days, that means – you will delete all data that comes with your extension. Any breaking change needs to schema to be recreated. And I can tell you, you’ll end up with breaking changes quite soon:

  • Renumber a field
  • Rename a field
  • Delete a field
  • Change datatype

For a development database, I don’t care, but for a test-database, for User Acceptance Testing, or even just functionality testing, it can be devastating to lose the data.

We realized that quite soon in our development cycle, data became important .. and we are not “just” in development phase anymore. When the app ends up in the test system (during release-pipeline), it should be a matter of upgrading, not a matter of “delete data and recreate the schema”.

So the only thing I think we can do is to handle the app as being a release/live app from the very first moment users start testing/data is important. That means: the schema shouldn’t change anymore, and if you have to change schema, it’s a matter of using obsolete fields and creating upgrade scripts – just like you would do in live!

Well, we will be “in development” for about a full year, and during that year, people need to test, users need to perform UATs, … and basically this means if we make wrong assumptions in the analysis of our design and architecture (and in an agile world, it’s not that uncommon) – we might end up with (lots) of obsolete tables and/or fields.

As you might have noticed – I don’t really have a comfortable way of handling this just yet… working on it!

Dependencies

Dependencies is a nice ability we have with Extensions. But I can tell you, when you are developing the base app, and the dependent app at the same time .. In team .. It does bring some challenges as well.

In a way, we all are dependent from different symbols – as we all want to run our app in multiple countries .. . In my view, it’s a good idea to include in your build process a workflow that tests if your app would deploy on these countries as well. That’s why our build looks something like:

  • Compile
  • Run code analysis
  • Create app
  • Deploy on W1
  • Deploy on BE
  • Deploy on CountryX

Thanks to this, we already avoided an error in development where we added a field that already existed in the BE database .. . It compiled well in W1, but it didn’t in BE.

On top of that, you might create two apps, where one is dependent on the other. In that case, you also need to include in your build process to test that dependency at all times. A simple compile of the dependent app is easy, but actually, when you change the base app, you should also see if your dependent app still compiles. In our scenario, a change on the base app, results in a build of all apps that are dependent from it.

Distributed development environment

With C/SIDE, lots of partners implemented a “centralized development environment”, which is quite unorthodox, but C/SIDE allowed it, and it was super easy. At all times, the developments were in one database, one overview, on “thing” to maintain.

With AL, we are “forced” to do it the right way. This is positive, for sure, but it’s different. Now, code will have be “continuously integrated” (which is indeed the “CI” part) – which means, merged. You don’t “just” checkout (and reserve) and object, you commit and merge, work with branches, … . All good, but different.

We use Git on VSTS, and work with pullrequests to pull new code in the master branch, which means we have introduced a code review together with this. Good stuff!

Docker

But this distributed environment also brings some challenges, which Docker can solve. Everyone needs to work on his own isolated development environment – you can’t be deploying your apps to the same NST as your colleague.

Docker solves this – as it’s easy to create a local container so you could start development – but it also comes with the assumption that people are able to work with Docker.

We have seen this is a difficult one – lots of developers (including me) are not infrastructural-minded. And in that case, “docker” becomes a lot more difficult.

We decided to go for a managed approach – if the developer creates a branch, we will spin up a new environment for him to do his deployments. Thing is, we wanted to do this as easy as possible – with the possibility for him to work remote, with only one entrypoint, like: project.ifacto.be/branchname . With Docker, that gets more difficult, as now we can’t just depend on a serverinstancename (which in Docker is always “NAV”), but we need to do some routing for every container we spin up. It’s not just 1 IP with multiple services, but it’s always a different IP with 1 service.

The alternative is that every developer is going to manage his own docker container on his own VM on his own laptop. All of a sudden, we’d have to support local development environments of developers on their laptops – I don’t see that feasible, actually.. . At least not yet ;-).

Tests

With tests, we have one big “challenge”: it’s not possible to run a complete default test just yet. So for the moment, in our setup, running a complete test is not implemented.

But that doesn’t mean we can’t implement our own tests – and that’s something we do. And we also execute with every single build, triggered by the pullrequests.

On top of that, we should also test all the dependencies as well – if you change something on the base-app, it’s obvious that some dependent app might have failed tests.. That’s another reason to always rebuild the dependent apps as well. Keep that in mind ;-).

Translations

As you probably know, the way we will do translations has grown up as well. Developers don’t need to be linguistics anymore ;-). Translation is done through xlf-files, “outside” the code.

But this also means we need to manage that in our process.

All the team members will be creating their own branched xlf-file – which will conflict every single time you try to merge branches. So best thing is – handle translations totally outside the build-scope. At this point, I put the xlf-files in .gitignore. What I haven’t done yet is implement a workflow for handling translations just yet, because we don’t need it yet.

That’s it for now .. I hope this post at least opened some eyes, or confirmed some concerns, or even helped you in solving some of the points … . In any case, Belgium just lost their semi-finals on the World Cup – so I’m signing out and going to be grumpy now ..

Nav on Docker HOL

Original URL…

All shipped versions of NAV since NAV 2016RTM are available on the public docker hub, where you also can find the EULA and the supported tags: https://hub.docker.com/r/microsoft/dynamics-nav/.
Under Tags, you will find a list of all the tags in the public repository. Docker images are constructed in layers. That means a Docker pull will only need to download those
layers that are different from already downloaded layers.
Docker image names are build up of 3 sections:
<registry>/<repository>:<tag>
<registry> can be a private registry (like navinsider.azurecr.io) or the public docker hub, using a single identifier (like microsoft).
<repository> is for all NAV images dynamics-nav
<tag> determines which NAV image to get.
The tag is build up by this syntax: [[version][cu]][localization]
All parts of the tag are optional and if you omit a part, you will get the latest (or w1 for the localization).
Parts are seperated by a dash if multiple parts are specified and all parts are specified using lower case characters.
Example of valid image names:
microsoft/dynamics-nav – gives you the latest cumulative update for the latest NAV version with the worldwide (W1) localization
microsoft/dynamics-nav:dk – gives you the latest cumulative update for the latest NAV version with the Danish (DK) localization
microsoft/dynamics-nav:2017-w1 – gives you the latest cumulative update for NAV 2017 with the worldwide localization
microsoft/dynamics-nav:2016-cu24 – gives you CU24 NAV 2016 with the worldwide localization
microsoft/dynamics-nav:2018-cu2-na – gives you the CU2 for NAV 2018 with the North American (NA) localization
The number of tags is pretty extensive, but you can build up any tag from the above syntax.
The devpreviews are special tags [devpreview][month][localization] – devpreview-february is the latest while writing and localization starts with fin (for financials)
Additionally all images are tagged with [buildnumber][localization], where buildnumber is the build number (e.g. 11.0.20348.0)
As a consequence, microsoft/dynamics-nav:11.0.20348.0-dk – gives you NAV 2018 CU2 with Danish localization.

Microsoft Flow and Business Central how to open the documument from the approval e-mail

ORIGINAL URL…

In a previous blog I already talked about the great opportunities of Microsoft Flow in combination with Business Central and NAV 2018. With one of the previous releases even more templates where created. There are now templates for all most all document flows.

These templates will save time when creating new workflows. Workflow templates are non-editable workflows that exist in the generic version of Business Central. The codes for workflow templates that are added by Microsoft are prefixed with “MS-“.

In the Workflow window, you create a workflow by listing the involved steps on the lines. Each step consists of a workflow event, moderated by event conditions, and a workflow response, moderated by response options. You define workflow steps by filling fields on workflow lines from fixed lists of event and response values representing scenarios that are supported by the application code. For more information, see Create Workflows.

Opening the document from the approval e-mail.

There is one thing not part of the standard approval workflow. Because although an e-mail is sent with the approval request, there is no way to open the document from the e-mail. If you, however, add an URL to the body of the e-mail this will be possible.

This URL composed of the following blocks

  • Default start – https://businesscentral.dynamics.com/
  • Name of your company =“company” Spaces in the company should be replaced with %20. Example ?company=CRONUS%20NL
  • Page you want to open &page=”page number& example &page=51. Because we are looking for the Purchase Invoice.
  • The filter you want to put on the page &filter=’No.’%20IS%20’number’ . This document number is available in the flow logic.

Want to know more about Business Central and Flow:

Wat is Business Central

10 Voordelen van Business Central

Example – Hello World – Your first extension

Original URL…

Extending Visual Studio Code

Your first extension

This document will guide you through creating your first VS Code extension (“Hello World”) and explain the basic VS Code extensibility concepts.

In this walkthrough, you’ll add a new command to VS Code which will display a simple “Hello World” message. Later in the walkthrough, you’ll interact with the VS Code editor and query for the user’s currently selected text.

Prerequisites

You need Node.js installed and available in your $PATH. Node.js includes npm, the Node.js Package Manager, which will be used to install the extension generator.

Generate a new extension

The simplest way to add your own functionality to VS Code is through adding a command. A command registers a callback function which can be invoked from the Command Palette or with a key binding.

We have written a Yeoman generator to help get you started. Install Yeoman and the Yeoman VS Code Extension generator and scaffold a new extension:

npm install -g yo generator-code
yo code

For the hello world extension, you can either create a TypeScript extension or a JavaScript one. For this example, we pick a TypeScript extension.

The command generator

Running your extension

  • Launch VS Code, choose File > Open Folder and pick the folder that you generated.
  • Press F5 or click on the Debug icon and click Start.
  • A new instance of VS Code will start in a special mode (Extension Development Host) and this new instance is now aware of your extension.
  • Press Ctrl+Shift+P and run the command named Hello World.
  • Congratulations! You’ve just created and executed your first VS Code command!

Running VS Code with an extension

The structure of an extension

After running, the generated extension should have the following structure:

.
├── .gitignore
├── .vscode                     // VS Code integration
│   ├── launch.json
│   ├── settings.json
│   └── tasks.json
├── .vscodeignore               // files ignored when publishing extension
├── README.md
├── src
│   └── extension.ts            // the source of the extension entry point
├── test                        // test folder
│   ├── extension.test.ts       // extension.test.js, in case of JavaScript extension
│   └── index.ts                // index.js, in case of JavaScript extension
├── node_modules
│   ├── vscode                  // include vscode type definition file 
for extension development
│   └── typescript              // compiler for typescript (TypeScript only)
├── out                         // compilation output (TypeScript only)
│   ├── extension.js            // the extension entry point
│   ├── extension.js.map
│   └── test
│       ├── extension.test.js
│       ├── extension.test.js.map
│       ├── index.js
│       └── index.js.map
├── package.json                // extension's manifest
├── tsconfig.json               // jsconfig.json, in case of JavaScript extension
└── vsc-extension-quickstart.md // extension development quick start

Let’s go through the purpose of all these files and explain what they do:

The extension manifest: package.json

Example TypeScript extension manifest

{
    "name": "myFirstExtension",
    "description": "",
    "version": "0.0.1",
    "publisher": "",
    "engines": {
        "vscode": "^1.5.0"
    },
    "categories": [
        "Other"
    ],
    "activationEvents": [
        "onCommand:extension.sayHello"
    ],
    "main": "./out/extension",
    "contributes": {
        "commands": [{
            "command": "extension.sayHello",
            "title": "Hello World"
        }]
    },
    "scripts": {
        "vscode:prepublish": "tsc -p ./",
        "compile": "tsc -watch -p ./",
        "postinstall": "node ./node_modules/vscode/bin/install",
        "test": "node ./node_modules/vscode/bin/test"
    },
    "devDependencies": {
       "typescript": "^2.0.3",
        "vscode": "^1.5.0",
        "mocha": "^2.3.3",
        "@types/node": "^6.0.40",
        "@types/mocha": "^2.2.32"
   }
}

Note: A JavaScript extension doesn’t require the scripts field as no compilation is needed.

This specific package.json describes an extension that:

  • contributes an entry to the Command Palette (Ctrl+Shift+P) with the label "Hello world" that will invoke a command "extension.sayHello".
  • requests to get loaded (activationEvents) when the command "extension.sayHello" is invoked.
  • has its main JavaScript code in a file called "./out/extension.js".

Note: VS Code does not load the code of an extension eagerly at start-up. An extension must describe, through the activationEvents property under what conditions it should get activated (loaded).

Generated code

The generated extension’s code is in extension.ts (or extension.js in case of a JavaScript extension):

// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {

    // Use the console to output diagnostic information (console.log) and 
errors (console.error)
    // This line of code will only be executed once when your extension is activated
    console.log('Congratulations, your extension "my-first-extension" is now 
active!');

    // The command has been defined in the package.json file
    // Now provide the implementation of the command with  registerCommand
    // The commandId parameter must match the command field in package.json
    let disposable = vscode.commands.registerCommand('extension.sayHello', () => {
        // The code you place here will be executed every time your 
command is executed

        // Display a message box to the user
        vscode.window.showInformationMessage('Hello World!');
    });

    context.subscriptions.push(disposable);
}
  • Each extension should export from its main file a function named activate(), which VS Code will invoke only once when any of the activationEvents described in the package.json file occur.
  • If an extension makes use of OS resources (e.g. spawns processes), the extension can export from its main file a function named deactivate() where it can do clean-up work and VS Code will invoke that function on shutdown.
  • This specific extension imports the vscode API and then registers a command, associating a function to be called when the command "extension.sayHello" gets invoked. The command’s implementation displays a “Hello world” message in VS Code.

Note: The contributes section of the package.json adds an entry to the Command Palette. The code in extension.ts/.js defines the implementation of "extension.sayHello".

Note: For TypeScript extensions, the generated file out/extension.js will be loaded at runtime and executed by VS Code.

Miscellaneous files

  • .vscode/launch.json defines launching VS Code in the Extension Development mode. It also points with preLaunchTask to a task defined in .vscode/tasks.json that runs the TypeScript compiler.
  • .vscode/settings.json by default excludes the out folder. You can modify which file types you want to hide.
  • .gitignore – Tells Git version control which patterns to ignore.
  • .vscodeignore – Tells the packaging tool which files to ignore when publishing the extension.
  • README.md – README file describing your extension for VS Code users.
  • vsc-extension-quickstart.md – A Quick Start guide for you.
  • test/extension.test.ts – you can put your extension unit tests in here and run your tests against the VS Code API (see Testing Your Extension)

Extension activation

Now that the roles of the files included in the extension are clarified, here is how your extension gets activated:

  • The extension development instance discovers the extension and reads its package.json file.
  • Later when you press Ctrl+Shift+P:
  • The registered commands are displayed in the Command Palette.
  • In this list there is now an entry "Hello world" that is defined in the package.json.
  • When selecting the "Hello world" command:
  • The command "extension.sayHello" is invoked:
    • An activation event "onCommand:extension.sayHello" is created.
    • All extensions listing this activation event in their activationEvents are activated.
      • The file at ./out/extension.js gets loaded in the JavaScript VM.
      • VS Code looks for an exported function activate and calls it.
      • The command "extension.sayHello" is registered and its implementation is now defined.
  • The command "extension.sayHello" implementation function is invoked.
  • The command implementation displays the “Hello World” message.

Debugging your extension

Set a breakpoint, for example inside the registered command, and run the "Hello world" command in the Extension Development VS Code instance.

Debugging the extension

Note: For TypeScript extensions, even though VS Code loads and executes out/extension.js, you are actually able to debug the original TypeScript code due to the generated source map out/extension.js.map and VS Code’s debugger support for source maps.

Tip: The Debug Console will show all the messages you log to the console.

To learn more about the extension development environment.

A simple change

In extension.ts (or extension.js, in a JavaScript extension), try replacing the extension.sayHello command implementation to show the number of characters selected in the editor:

    let disposable = vscode.commands.registerCommand('extension.sayHello', () => {
        // The code you place here will be executed every time your 
command is executed

        let editor = vscode.window.activeTextEditor;
        if (!editor) {
            return; // No open text editor
        }

        let selection = editor.selection;
        let text = editor.document.getText(selection);

        // Display a message box to the user
        vscode.window.showInformationMessage('Selected characters: ' + text.length);
    });

Tip: Once you make changes to the extension source code, you need to restart the Extension Development Host instance of VS Code. You can do that by using Ctrl+R (macOS: Cmd+R) in the Extension Development Host instance or by clicking the Restart button at the top of your primary VS Code instance.

Create a file (File > New File), type some text and select it. When you run the Hello World command, you should now see the count of selected characters.

Running the modified extension

Installing your extension locally

So far, the extension you have written only runs in a special instance of VS Code, the Extension Development instance. To get your extension running in all instances of VS Code, you need to copy it to a new folder under your local extensions folder:

  • Windows: %USERPROFILE%\.vscode\extensions
  • macOS/Linux: $HOME/.vscode/extensions

Publishing your extension

Read about how to Share an Extension.

Next Steps

In this walkthrough, we’ve seen a very simple extension. For a more detailed example, see the Word Count Example which shows how to target a specific language (Markdown) and listen to the editor’s document changed events.

If you’d like to read more generally about the extension APIs, try these topics:

Get Started – Install NavContainerHelper

Original URL…

PS C:\WINDOWS\system32> get-command -Module navcontainerhelper

CommandType Name Version Source
———– —- ——- ——
Function Backup-NavContainerDatabases 0.3.0.1 navcontainerhelper
Function Compile-AppInNavContainer 0.3.0.1 navcontainerhelper
Function Compile-ObjectsInNavContainer 0.3.0.1 navcontainerhelper
Function Convert-ModifiedObjectsToAl 0.3.0.1 navcontainerhelper
Function Convert-Txt2Al 0.3.0.1 navcontainerhelper
Function Copy-FileFromNavContainer 0.3.0.1 navcontainerhelper
Function Copy-FileToNavContainer 0.3.0.1 navcontainerhelper
Function Create-AadAppsForNav 0.3.0.1 navcontainerhelper
Function Create-AadUsersInNavContainer 0.3.0.1 navcontainerhelper
Function Create-MyDeltaFolder 0.3.0.1 navcontainerhelper
Function Create-MyOriginalFolder 0.3.0.1 navcontainerhelper
Function Download-File 0.3.0.1 navcontainerhelper
Function Enter-NavContainer 0.3.0.1 navcontainerhelper
Function Export-ModifiedObjectsAsDeltas 0.3.0.1 navcontainerhelper
Function Export-NavContainerDatabasesAsBacpac 0.3.0.1 navcontainerhelper
Function Export-NavContainerObjects 0.3.0.1 navcontainerhelper
Function Get-CompanyInNavContainer 0.3.0.1 navcontainerhelper
Function Get-LocaleFromCountry 0.3.0.1 navcontainerhelper
Function Get-NavContainerAppInfo 0.3.0.1 navcontainerhelper
Function Get-NavContainerCountry 0.3.0.1 navcontainerhelper
Function Get-NavContainerDebugInfo 0.3.0.1 navcontainerhelper
Function Get-NavContainerEula 0.3.0.1 navcontainerhelper
Function Get-NavContainerEventLog 0.3.0.1 navcontainerhelper
Function Get-NavContainerGenericTag 0.3.0.1 navcontainerhelper
Function Get-NavContainerId 0.3.0.1 navcontainerhelper
Function Get-NavContainerImageName 0.3.0.1 navcontainerhelper
Function Get-NavContainerIpAddress 0.3.0.1 navcontainerhelper
Function Get-NavContainerLegal 0.3.0.1 navcontainerhelper
Function Get-NavContainerName 0.3.0.1 navcontainerhelper
Function Get-NavContainerNavUser 0.3.0.1 navcontainerhelper
Function Get-NavContainerNavVersion 0.3.0.1 navcontainerhelper
Function Get-NavContainerOsVersion 0.3.0.1 navcontainerhelper
Function Get-NavContainerPath 0.3.0.1 navcontainerhelper
Function Get-NavContainers 0.3.0.1 navcontainerhelper
Function Get-NavContainerServerConfiguration 0.3.0.1 navcontainerhelper
Function Get-NavContainerSession 0.3.0.1 navcontainerhelper
Function Get-NavContainerSharedFolders 0.3.0.1 navcontainerhelper
Function Get-NavContainerTenants 0.3.0.1 navcontainerhelper
Function Get-NavVersionFromVersionInfo 0.3.0.1 navcontainerhelper
Function Import-ConfigPackageInNavContainer 0.3.0.1 navcontainerhelper
Function Import-DeltasToNavContainer 0.3.0.1 navcontainerhelper
Function Import-NavContainerLicense 0.3.0.1 navcontainerhelper
Function Import-ObjectsToNavContainer 0.3.0.1 navcontainerhelper
Function Import-TestToolkitToNavContainer 0.3.0.1 navcontainerhelper
Function Install-NavContainerApp 0.3.0.1 navcontainerhelper
Function Install-NAVSipCryptoProviderFromNavContainer 0.3.0.1 navcontainerhelper
Function Invoke-NavContainerCodeunit 0.3.0.1 navcontainerhelper
Function New-CompanyInNavContainer 0.3.0.1 navcontainerhelper
Function New-CSideDevContainer 0.3.0.1 navcontainerhelper
Function New-DesktopShortcut 0.3.0.1 navcontainerhelper
Function New-LetsEncryptCertificate 0.3.0.1 navcontainerhelper
Function New-NavContainer 0.3.0.1 navcontainerhelper
Function New-NavContainerNavUser 0.3.0.1 navcontainerhelper
Function New-NavContainerTenant 0.3.0.1 navcontainerhelper
Function New-NavContainerWindowsUser 0.3.0.1 navcontainerhelper
Function Open-NavContainer 0.3.0.1 navcontainerhelper
Function Publish-NavContainerApp 0.3.0.1 navcontainerhelper
Function Remove-CompanyInNavContainer 0.3.0.1 navcontainerhelper
Function Remove-ConfigPackageInNavContainer 0.3.0.1 navcontainerhelper
Function Remove-DesktopShortcut 0.3.0.1 navcontainerhelper
Function Remove-NavContainer 0.3.0.1 navcontainerhelper
Function Remove-NavContainerSession 0.3.0.1 navcontainerhelper
Function Remove-NavContainerTenant 0.3.0.1 navcontainerhelper
Function Renew-LetsEncryptCertificate 0.3.0.1 navcontainerhelper
Function Replace-NavServerContainer 0.3.0.1 navcontainerhelper
Function Restart-NavContainer 0.3.0.1 navcontainerhelper
Function Setup-NavContainerTestUsers 0.3.0.1 navcontainerhelper
Function Start-NavContainer 0.3.0.1 navcontainerhelper
Function Start-NavContainerAppDataUpgrade 0.3.0.1 navcontainerhelper
Function Stop-NavContainer 0.3.0.1 navcontainerhelper
Function Sync-NavContainerApp 0.3.0.1 navcontainerhelper
Function Test-NavContainer 0.3.0.1 navcontainerhelper
Function UnInstall-NavContainerApp 0.3.0.1 navcontainerhelper
Function UnPublish-NavContainerApp 0.3.0.1 navcontainerhelper
Function Wait-NavContainerReady 0.3.0.1 navcontainerhelper
Function Write-NavContainerHelperWelcomeText 0.3.0.1 navcontainerhelper

PS C:\WINDOWS\system32> Write-NavContainerHelperWelcomeText

Welcome to the Nav Container Helper PowerShell Prompt

Container info functions
Get-NavContainerNavVersion Get Nav version from NAV container or image
Get-NavContainerImageName Get ImageName from NAV container
Get-NavContainerGenericTag Get Nav generic image tag from NAV container or image
Get-NavContainerOsVersion Get OS version from NAV container or image
Get-NavContainerEula Get Eula link from NAV container or image
Get-NavContainerLegal Get Legal link from NAV container or image
Get-NavContainerCountry Get country version from NAV container or image
Get-NavContainerIpAddress Get IP Address to a NAV container
Get-NavContainerSharedFolders Get Shared Folders from a NAV container
Get-NavContainerPath Get the path inside a NAV container to a shared file
Get-NavContainerName Get the name of a NAV container
Get-NavContainerId Get the Id of a NAV container
Test-NavContainer Test whether a NAV container exists
Get-NavContainerDebugInfo Get Troubleshooting info for NAV container if you need help with an issue
Get-NavContainers Get All Nav Containers
Get-NavContainerEventLog Get EventLog from Nav Container
Get-NavContainerServerConfiguration Get Server Configuration from Nav Container

Container handling functions
New-NavContainer Create new Nav container
Remove-NavContainer Remove Nav container
Stop-NavContainer Stop Nav container
Start-NavContainer Start Nav container
Restart-NavContainer Restart Nav container
Import-NavContainerLicense Import License to a NAV Container
Get-NavContainerSession Create new session to a Nav container
Remove-NavContainerSession Remove Nav container session
Enter-NavContainer Enter Nav container session
Open-NavContainer Open Nav container in new window
Wait-NavContainerReady Wait for Nav Container to become ready
Copy-FileFromNavContainer Copy file from Nav Container
Copy-FileToNavContainer Copy file to Nav Container
Export-NavContainerDatabasesAsBacpac Export database(s) in Nav Container as BacPac
Backup-NavContainerDatabases Backup database(s) in Nav Container as bak

Object handling functions
Import-ObjectsToNavContainer Import objects from .txt or .fob file to Nav Container
Import-DeltasToNavContainer Merge delta files and Import objects to Nav Container
Import-TestToolkitToNavContainer Import TestToolkit to Nav Container
Compile-ObjectsInNavContainer Compile objects
Export-NavContainerObjects Export objects from Nav container
Create-MyOriginalFolder Create folder with the original objects for modified objects
Create-MyDeltaFolder Create folder with deltas for modified objects
Convert-Txt2Al Convert deltas folder to al folder
Export-ModifiedObjectsAsDeltas Export objects, create baseline and create deltas
Convert-ModifiedObjectsToAl Export objects, create baseline, create deltas and convert to .al files
Invoke-NavContainerCodeunit Invoke Codeunit in Nav Container

App handling functions
Compile-AppInNavContainer Use Container to compile App
Publish-NavContainerApp Publish App to Nav container
Sync-NavContainerApp Sync App in Nav container
Install-NavContainerApp Install App in Nav container
Uninstall-NavContainerApp Uninstall App from Nav container
Unpublish-NavContainerApp Unpublish App from Nav container
Get-NavContainerAppInfo Get info about installed apps from Nav Container
Start-NavContainerAppDataUpgrade Start Data Upgrade for an App in a Nav Container
Install-NAVSipCryptoProviderFromNavContainer Install Nav Sip Crypto Provider locally from container to sign extensions

Tenant handling functions
Get-NavContainerTenants Get all tenants in Nav Container
New-NavContainerTenant Create tenant in multitenant Nav Container
Remove-NavContainerTenant Remove tenant from multitenant Nav Container

User handling functions
Get-NavContainerNavUser Get all users in Nav Container
New-NavContainerNavUser Create new Nav User in Nav Container
New-NavContainerWindowsUser Create new Windows User in Nav Container
Setup-NavContainerTestUsers Create a set of users for test purposes

Company handling functions
Get-CompanyInNavContainer Get a list of Companies in Nav Container
New-CompanyInNavContainer Create new Company in Nav Container
Remove-CompanyInNavContainer Remove Company from Nav Container

Configuration package handling functions
Import-ConfigPackageInNavContainer Import Configuration package in Nav Container
Remove-ConfigPackageInNavContainer Remove Configuratioin package from Nav container

Azure AD specific functions
Create-AadAppsForNav Create Apps in Aad for AAD authentication support
Create-AadUsersInNavContainer Create all active users in the Aad in the Nav Container

Azure VM specific functions
Replace-NavServerContainer Replace or recreate navserver (primary) container
New-LetsEncryptCertificate Create Lets Encrypt Certificate for secure communication
Renew-LetsEncryptCertificate Renew Lets Encrypt Certificate for secure communication

Note: The Nav Container Helper is an open source project from http://www.github.com/microsoft/navcontainerhelper.
The project is released as-is, no warranty! Contributions are welcome, study the github repository for usage.
Report issues on http://www.github.com/microsoft/navcontainerhelper/issues.

Get started – run your first NAV container

Start PowerShell ISE and run this command:

New-NavContainer -accept_eula -containerName "test" -auth NavUserPassword 
-imageName "microsoft/dynamics-nav"

to run your first NAV container using NavUserPassword authentication. PowerShell will pop up a dialog and require you to enter a username and a password to use for the container.

Note, if you are running Windows 10 , you will have to add –memory 4G as an extra parameter to the docker run command above (and in all docker run commands in this doc.)

How to get the new Dynamics 365 Business Central and extend it

Original URL…

What is it?

Dynamics 365 Business Central is the new and, I hope, the last official name of Dynamics NAV.

No more Dynamics 365 Finance and operations Business Edition, no more Dynamics 365 “Tenerife”, even no more Dynamics NAV (basically it is yes now, until Q4 2018, when D365BC on-premise will be released)!

The official announcement was made 4 days ago and can be found here.

2 days after at DirectionsASIA we’ve got much more information about the product from Microsoft team.

The official hashtag is #MSDyn365BC, and if you will search it on twitter you will find a huge portion of images and info about new web client, new roadmap, new possibilities and so on.

But this blog is not about What’s new staff. It is about How to get it?

Step 1. Register on collaborate portal

If you are already registered – skip it. If not, go to https://aka.ms/collaborate and register.

The registration process is very nice described here https://docs.microsoft.com/en-us/collaborate/registration

Just go steps by steps, and you should be able to see this

 

Step 2. Register on Ready to Go program (Updated)

After publishing first version of this blog, I’ve got many questions about why D365BC is not visible on collaboration portal. Because of this step was missed. Sorry. Updated.

If you are already registered – skip it. If not you should sign up for Ready to Go program http://aka.ms/ReadyToGo

To do so, after step 1, please write an e-mail to Dyn365BEP@microsoft.com

When contacting, please provide following information:

Publisher display name Name Email Role
Chosen during registration, should be the same for all users User 1 Email 1 Power user (can access content and add new users to engagements)
User 2 Email 2 Participant (can access content)
Etc. Etc. Power user

The registration process should take 1-2 business days.

After successful registration, you will be able to see this

 

YES! This is pre-release version of NEW Dynamics 365 Business Central.

If you click on it you will find something interesting, guess what?

.Zip, DVD?  No =)

You will find 2kb txt file with instructions of …. How to get it via Docker.

Download it.

Advantages of Ready to Go program

Ready to Go program, it is not only the possibility to download and play with pre-release versions of Dynamics 365 Business Central.

The idea is to prepare every partner for new SaaS world. It consists of training materials on http://aka.ms/ReadyToGoOnlineLearning and also potentially coaching through a Development Centres

BTW. If you want to prepare yourself for new modern SaaS world, you can also contact me for individual workshops and coaching.

Step 3. Create new Docker container with Dynamics 365 Business Central

But first, Install Docker.

If you don’t have docker, then download and install it. You can choose to download a full docker client or only a module.

You can download and install docker as a module executing this code in PowerShell

invoke-webrequest -UseBasicparsing -Outfile docker-17.09.0-ce.zip 
https://download.docker.com/win/static/stable/x86_64/docker-17.09.0-ce.zip
# Extract the archive.
Expand-Archive docker-17.09.0-ce.zip -DestinationPath $Env:ProgramFiles

# Clean up the zip file.
Remove-Item -Force docker-17.09.0-ce.zip

# Install Docker. This requires rebooting.
$null = Install-WindowsFeature containers

# Add Docker to the path for the current session.
$env:path += ";$env:ProgramFiles\docker"

# Optionally, modify PATH to persist across sessions.
$newPath = "$env:ProgramFiles\docker;" +
[Environment]::GetEnvironmentVariable("PATH",
[EnvironmentVariableTarget]::Machine)

[Environment]::SetEnvironmentVariable("PATH", $newPath,
[EnvironmentVariableTarget]::Machine)

# Register the Docker daemon as a service.
dockerd --register-service

# Start the Docker service.
Start-Service docker

#Next steps are optional!

#Run test container, to check that Docker is alive
docker container run hello-world:nanoserver

# Check what containers do you have
docker ps

Next, install Navcontainerhelper

I personally love what Freddy has done to us. So I will use navcontainerhelper to simplify my work.

Run next script in PowerShell

Install-Module -Name navcontainerhelper -Verbose

If, you are running it on Windows10, check that your policy is allowed you to install new modules.

If it is restricted, then change it

Create new D365 Business Central container

1)    Login to azure container register, to be able to pull (download) D365BE Image (also in powershell).

docker login "navinsider.azurecr.io" -u 
"insert-user-id-here-from-Build-21063.txt-file" -p " 
insert-password-here-from-Build-21063.txt-file "

2)    Choose what version of Business Central do you want.

Currently available 14 Versions and W1!

dynamics-nav:11.0.21063.0

dynamics-nav:11.0.21063.0-finat

dynamics-nav:11.0.21063.0-finbe

dynamics-nav:11.0.21063.0-finca

dynamics-nav:11.0.21063.0-finch

dynamics-nav:11.0.21063.0-finde

dynamics-nav:11.0.21063.0-findk

dynamics-nav:11.0.21063.0-fines

dynamics-nav:11.0.21063.0-finfi

dynamics-nav:11.0.21063.0-finfr

dynamics-nav:11.0.21063.0-fingb

dynamics-nav:11.0.21063.0-finit

dynamics-nav:11.0.21063.0-finnl

dynamics-nav:11.0.21063.0-finse

dynamics-nav:11.0.21063.0-finus

3)    Create new container

I will use W1 version, so I run next command in PowerShell

New-NavContainer -accept_eula -alwaysPull -imageName 
"navinsider.azurecr.io/dynamics-nav:11.0.21063.0" -containerName D365BC-W1

and after a while – about 5 minutes of pulling (depends on your internet speed), and 2 minutes of initialization – we have it!

This wonderful, modern look and feel web UI

Hmm…. Not really what I was expected =)

Let’s try old trick =) We will add ?aid=fin to the end of our URL.

So url will be http://d365bc-w1/nav/?aid=fin

 

Much better now!

By the way, if you will create a container from US image (dynamics-nav:11.0.21063.0-finus), then we will have new web UI by default.

 

Step 4. Extend it!

Install Visual Studio Code AL extension

First copy .vsix file on your host.

To do so, copy a link to vsix file from container creation log

Open it in a browser

Click Save.

Open Visual Studio Code. Go to Extentions -> … -> Install From Vsix

Create new AL project

As usual, press Crtl + Shift + P -> AL:Go

We change server in launch.json (take it from container creation log), and authentication to Windows.

Press Crtl + Shift + P -> AL:Download Symbols

Then we will create some new code.

We will add one more insight to RoleCenter. This is really wow feature of new UI.

After publishing (ctrl+F5) we will see new insight!

And we’ve done!

I encourage you to take all advantages of Collaborate and start exploring Dynamics 365 Business Central right now!