business-central

by lippertmarkus

Helm chartv2.2.14App 20.0.37253.40399Verified publisher

An unofficial Helm chart for Microsoft Dynamics 365 Business Central on Kubernetes

About this chart

Microsoft Dynamics 365 Business Central

Streamline your processes, make smarter decisions, and accelerate growth with Dynamics 365 Business Central — a comprehensive business management solution designed for small to medium-sized businesses.

-- Business Central Product Page

This is an unofficial Helm chart for running Microsoft Dynamics 365 Business Central on Kubernetes.

Prerequisites

  • Kubernetes: >= 1.18.0
  • Windows nodes in your cluster

TL;DR;

If you use a managed Kubernetes cluster or your on-premises cluster supports LoadBalancer services, the easiest way to install with the default configuration (image requiring Windows Server 2019 build 10.0.17763.1397 or newer) is:

helm repo add lippertmarkus https://charts.lippertmarkus.com
helm install my-release lippertmarkus/business-central --set service.type=LoadBalancer

Follow the instructions displayed after the installation on how to get the external IP to access the Business Central web client.

Have a look at the common scenarios section to quickly get familiar with the core possibilities of this chart.

Introduction

This chart deploys Microsoft Dynamics 365 Business Central based on the official Docker images from Microsoft. It aims to simplify deployment of Business Central within a cluster.

It supports using Business Central artifacts to set up the desired version on-demand as well as pre-built images. Further you can easily secure your passwords, use an external database, use custom scripts to override the default behavior, setup access via ingress or a load balancer and automatically download and publish AL extensions on startup.

Installing the Chart

To install the chart with the release name myrelease and the default configuration (image requiring Windows Server 2019 build 10.0.17763.1397 or newer) use:

helm repo add lippertmarkus https://charts.lippertmarkus.com
helm install myrelease lippertmarkus/business-central

The default configuration only allows cluster-internal access to your Business Central instance (ClusterIP service). Follow the instructions displayed after the installation on how to use kubectl port-forward to gain access.

For external access you may want to use ingress, a load balancer or expose the service via your node ports by configuring ingress.* or service.type.

Uninstalling the Chart

For uninstalling your release myrelease execute:

helm uninstall myrelease lippertmarkus/business-central

This removes all resources from your cluster.

Common Scenarios

The next sections describe some common scenarios and the required configuration for them. While you can directly specify configuration parameters on helm install with --set, the next sections also show parts of configuration files which can be used on installation like:

helm install myrelease lippertmarkus/business-central -f config.yml

You can find a detailed explanation of all the presented configuration options within the configuration reference.

Accessing Business Central

There are four ways for accessing Business Central:

  • The default configuration only allows cluster-internal access to your Business Central instance (ClusterIP service). Follow the instructions displayed after the installation on how to use kubectl port-forward to gain access.

  • If you use a managed Kubernetes cluster or your on-premises cluster supports LoadBalancer services, the easiest way to set up external access is to set service.type to LoadBalancer. Follow the instructions displayed after the installation on how to get the external IP to access the Business Central web client.

  • You can also access Business Central via ports of the nodes in your cluster by setting service.type to NodePort. Follow the instructions displayed after the installation on how to get the port to access the Business Central web client via your Nodes.

  • Using Ingress is another option. If you already have an ingress controller deployed you can just enable the ingress option and define the hosts where the web client and web service endpoints should be accessible at:

ingress:
  enabled: true
  hosts:
    - host: bc1.example.com
      path: /  # optional, use a sub path
      servicePort: web
    - host: dev.bc1.example.com
      servicePort: dev

Using artifacts and pre-built images

There are many versions of Business Central as well as monthly updates. Beyond there's a requirement for Windows Containers that the Windows version of the base image of a container must match the version of the host OS (when using process isolation).

Instead of providing images for each Business Central version on each Windows version, Microsoft decided to instead provide generic images for each Windows version as well as artifacts for installing Business Central onto those generic images. You can either use the artifact to create your own images based on the generic image or use the generic image directly and specify the artifacts which get downloaded and installed at startup.

To use the generic image and artifacts, set:

image:
  repository: mcr.microsoft.com/businesscentral
  tag: "10.0.17763.1397"
  artifactUrl: "https://bcartifacts.azureedge.net/onprem/16.5.15897.15953/w1"

There's a list of available tags where you should look after a tag matching the OS version of the Windows nodes within your cluster. Tags of the same Windows version but an older build number also work fine.

For getting the artifact URL you can use the BcContainerHelper PowerShell module with the Get-BcArtifactUrl Cmdlet like described here.

If you want to use pre-built images instead, just set your own image and remove the artifact URL:

image:
  repository: myrepo/myimage
  tag: "16.5.15897.15953-w1"
  artifactUrl: ""

You can build your own image with the New-BcImage Cmdlet of the BcContainerHelper PowerShell module like described here.

Using external databases

When using a generic image and artifacts there's a demonstration database available. If you use your own pre-built images you could also add your own database to the image.

Instead of using those databases you can further use an external database:

database:
  custom: true
  server: "myserver.database.windows.net"
  instance: ""  # use default SQL server instance
  name: "cronus"
  username: "sa"
  #password: ""  # insecure plaintext password, use encrypted password below is recommended
  securePassword: "76492d1116743f042..."

passwordKeySecretName: "mysecret"   # only needed with database.securePassword

Details on how to encrypt your password are explained in the next section.

Setting a password

When you don't set a password, a random one will be generated for the admin user. This isn't secure but helps you getting started quickly. You can set a specific password by using one of the following:

#password: ""  # insecure plaintext password, using encrypted password below is recommended
securePassword: "76492d1116743f042..."

passwordKeySecretName: "mysecret"  # only needed with securePassword

To create a new AES key, encrypt a password with it and store the key within a Kubernetes secret you can use the following PowerShell code:

# Create a new key
$passwordKey = New-Object Byte[] 16
[Security.Cryptography.RNGCryptoServiceProvider]::Create().GetBytes($passwordKey)

# Store the key within a Kubernetes secret
kubectl create secret generic mysecret --from-literal=passwordKey=$passwordKey

# Encrypt our password with the key
$securePassword = ConvertFrom-SecureString -SecureString (Get-Credential).Password -Key $passwordKey

Within the chart configuration you now set passwordKeySecretName to the name of the secret you created and securePassword or database.securePassword to your encrypted password stored in $securePassword.

Modifying default behavior

The official image of Business Central allows modifying the default behavior by adding custom script with the same filename as the original ones which are then called instead. You can easily add those scripts like in the following:

customScripts:
  AdditionalSetup.ps1: |-
    if ($true) {
        Write-Host "This was created by Kubernetes."
    }

Configuration via environment variables

There are a lot of environment variables you can use for configuring the Business Central container. Some of them like the ones for using external databases, specifying (secure) passwords and artifacts are set through the exposed Helm configuration parameters described before for simplicity. You can set the other ones in env:

env:
  username: admin
  HttpSite: "N"
  # ...

Automatically publishing AL extensions on startup (experimental)

If you deploy a Business Central environment you often also want to deploy an AL extension. To automate this as well you can use the publish option of the chart. The two default images are used to first download AL extensions from a NuGet feed and afterwards deploy them via the development endpoint.

To use this you need to configure which NuGet feed to use and which AL extensions should be downloaded:

publish:
  enabled: true
  download:
    params: 
      nugetLocation: "https://myorg.pkgs.visualstudio.com/myproj/_packaging/myfeed/nuget/v3/index.json"
      patSecretName: "mypat"
      dependencies:
        # This downloads two NuGet Packages Comp_AppName and Comp_AppName2 with the version 1.2.3.4
        - publisher: Comp
          name: AppName
          version: "1.2.3.4"
        - publisher: Comp
          name: AppName2
          version: "1.2.3.4"

For access to the NuGet feed you need to create a personal access token and store it within a Kubernetes secret referenced in publish.download.params.patSecretName:

kubectl create secret generic mypat --from-literal=pat=MwBEAE...

When using this, make sure to include --wait --timeout=10m in your helm install to make sure that the hook is executed after Business Central is up and healthy.

Disabling access to endpoints

For some environments you may want to disable external access to some endpoints like the ones for development, OData or SOAP. Per default all endpoints can be accessed. By setting the port of specific endpoints to an empty string, you can disable the access:

service:
  ports:
    # access to web client is still allowed (default configuration values)
    soap: ""  # disable SOAP
    odata: ""  # disable OData
    dev: ""  # disable development endpoint
    dl: ""  # disable file access endpoint

Configuration Reference

KeyTypeDefaultDescription
affinityobject{}Constrain which nodes the workload is eligible to be scheduled on, see Kubernetes docs.
customScriptsobject{}Add custom PowerShell scripts to the container. They can override the default scripts like described here.
database.customboolfalseEnable to connect to an external SQL server with a Business Central database.
database.instancestring""SQL Server instance to connect to, e.g. SQL2019. Leave empty to use the default instance.
database.namestring""Name of the database to connect to, e.g. cronus.
database.passwordstring""Insecure clear-text password of the user to connect with. Consider using database.securePassword and passwordKeySecretName instead.
database.securePasswordstring""AES-encrypted password of the user to connect with. Requires passwordKeySecretName to be set. See here on how this works.
database.serverstring""SQL Server to connect to, e.g. myserver.database.windows.net.
database.usernamestring""User used to connect to the SQL database, e.g. sa.
envobjectThe two variables below are set per defaultConfigure application via environment variables. See values.yaml for more options you can add.
env.Accept_eulastring"Y"Whether to accept (Y) or decline (N) the EULA.
env.UseSSLstring"N"Whether to use SSL for the webclient (Y) or not (N). If set to Y generates a self-signed certificate per default.
fullnameOverridestring""Override the full name of the deployment, e.g. myfullnameoverride.
image.artifactUrlstri

Deploy business-central with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has business-central on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartbusiness-central is pinned at v2.2.14 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply