Business Central Local Setup

Wed Apr 24, 2024 | 505 Words | 3 Minute

Image of a start picture
© SergejDK

Introduction

If you want to work with Business Central then you absolutely want to have a possible solution to try it out. Well you can go the way with a sandbox, which is a VM spin up on Azure with a test database and company named Cronus. Still there is a way to run it locally on your computer so you are not directly depended on Microsoft and Azure.

Prerequisites

First things first - you need Windows Pro. I used Windows 11 Pro for my local setup but I think this should also work for Windows 10. You think - why do I need the Pro version? Well you have to run Windows container and this is only possible with the pro version of windows.

Then you need Docker as we will run a docker container which includes a SQL Server and more.

Powershell for installing and running the needed scripts but it is installed beforehand.

Lastly we need Visual Studio Code to work with Business Central and deploy our application to the local container.

Setup

  1. Start Docker Desktop and switch to windows container. The small arrow at the right at the task bar - click it and right click on the docker logo. There you should see this option. If you see switch to linux container you have already switched.

    Docker Desktop information and switch to windows/linux

  2. Open Powershell as Admin.

  3. Call: Install-Module -Name BcContainerHelper

    This is a helper for handling all business central related stuff. One cheat sheet that help me was this one: Cheat Sheet

    It is possible that you can get an error which says you are not allowed to run this script. One possible solution to solve that is running the followinng command in powershell:

        Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
    
  4. Run: Import-Module BcContainerHelper

  5. For an easier setup there is a script created by Microsoft which guides you step-by-step to create a correct docker image which you can run anytime. You simply have to call the following function:

        Invoke-Expression (New-Object System.Net.WebClient).DownloadString("http://aka.ms/bcdockerscript")
    
  6. Follow those instructions and at the last step you are able to run the script directly and/or even safe it to a file to create other containers, too. It should look something like this:

    $containerName = 'learning-bcserver'
    $password = 'P@ssw0rd'
    $securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force
    $credential = New-Object pscredential 'admin', $securePassword
    $auth = 'UserPassword'
    $artifactUrl = Get-BcArtifactUrl -type 'Sandbox' -country 'en' -select 'Latest'
    New-BcContainer `
        -accept_eula `
        -containerName $containerName `
        -credential $credential `
        -auth $auth `
        -artifactUrl $artifactUrl `
        -assignPremiumPlan `
        -updateHosts
    

    If you want to create another container you can simply take this script and modify as needed. For example changing the country you simple have to switch the en to de for germany.

    In the docker desktop application you should an entry which should look like that: Docker Desktop entry with a container

Conclusion

It is very easy to setup a business central environment locally and should work on Windows 10 and 11 Pro. Most of the job is done by the script from Microsoft and the cheat sheet helps a lot to figure everything out about the BcContainerHelper.

comments powered by Disqus