Get started with the Container Sandbox Development Environment

Dynamics 365 Business Central offers a container-based image environment that enables access to the AL development environment.

You set up a container sandbox by running the Container Sandbox Environment page from Dynamics 365 Business Central. You will have to decide whether you want an Azure-hosted or locally hosted container sandbox. See the next section for details.

Tip

Dynamics 365 Business Central also offers an online sandbox. For more information, see Sandbox Environments for Dynamics 365 Business Central Development.

Choosing an Azure-hosted or local-hosted container sandbox

When you set up the container sandbox, you can choose to host the sandbox on Microsoft Azure or on a local computer. Both environments offer the same capabilities and use Docker to provide the infrastructure for the container-based application. The difference is:

  • With Azure hosting, Docker is installed and configured for you. However, Azure hosting requires that you sign up for an Azure subscription, and additional costs may be incurred for each container sandbox.
  • Local hosting requires that your computer is running Windows 10, Windows Server 2016, or Windows Server 2019, and you install and configure Docker before setting up the container sandbox.

Set up an Azure-hosted container sandbox

  1. If you you do not already have one, sign up for an Azure subscription.

    To get a free subscription and read more information, see https://azure.microsoft.com.

  2. In Dynamics 365 Business Central, choose the Lightbulb that opens the Tell Me feature. icon, enter Container Sandbox Environment, and then select the relevant link.

  3. Choose Host in Azure. If prompted, enter the user name and password of your Azure subscription.

    The Azure portal opens to display a custom deployment form.

  4. Fill out the required fields on the form, and then select Purchase.

Note

You must set the Accept Eula setting to Yes in order to continue.

Set up a local-hosted container sandbox

  1. If not already done, install Docker.

    To install and configure Docker, choose the version of Docker that is appropriate for the host operating system:

  2. In Dynamics 365 Business Central, choose the Lightbulb that opens the Tell Me feature. icon, enter SANDBOX ENVIRONMENT (CONTAINER), and then select the relevant link.

  3. Choose Host Locally.

  4. Save the CreateBCSandbox.ps1 file to your computer.

  5. Run Windows PowerShell ISE as an administrator.

  6. Open the CreateBCSandbox.ps1 file.

  7. Set the $containername = '' variable to the name that you want to give the container, for example $containername = 'mybc'.

    This name is only used internally in your envirorment for identification purposes.

  8. Set the $accept_eula = '' variable to '$true'.

  9. Press F5 to run the script.

    The console pane displays the progress of the script. When the script has completed successfully, information like the following will display:

    ...
    Container IP Address: 172.22.147.63
    Container Hostname  : mybc
    Container Dns Name  : mybc
    Web Client          : http://mybc/BC/
    Dev. Server         : http://mybc
    Dev. ServerInstance : BC
    
    Files:
    http://test:8080/ALLanguage.vsix
    
    Initialization took 116 seconds
    Ready for connections!
    Reading CustomSettings.config from mybc
    Creating Desktop Shortcuts for mybc
    
  10. Write down or copy the following parameter/values from the console: Dev. Server, Dev. ServerInstance, and Files. You will need this information later to set up Visual Studio Code for extension development.

You now have a container sandbox set up on your computer. The following shortcuts have been added to your desktop:

  • <Container name> Web Client - opens the Web client for the your application in the container.
  • <Container name> PowerShell Prompt - opens a Windows PowerShell prompt in the container. This gives you access to the Dynamics NAV (/powershell/business-central/overview), which you can run against the container sandbox environment.
  • <Container name>Command Prompt - opens a Windows command prompt in the container.

For more information about working with a container sandbox, see Running a Container-Based Development Environment.

Set up Visual Studio Code

After the container sandbox is set up, you must set up Visual Studio Code for extension development. To do this, you need the values for Dev. Server, Dev. ServerInstance, and Files parameters that you retrieved from the Windows PowerShell ISE console when you ran the CreateBCSandbox.ps1 script.

  1. In Visual Studio Code, go to Extensions, and install the AL Language extension from the Marketplace. You now have the AL Language extension for Microsoft Dynamics 365 Business Central enabled.

  2. In Visual Studio Code, press Ctrl+Shift+P and then choose AL Go!.

  3. Choose where to create the project, and then choose the Your own server option.

  4. Open the generated launch.json file, update the "server" setting with the value of the Dev. Server parameter and the "serverInstance" setting with the value of the Dev. ServerInstance to reflect the container you just created. For example:

    "server": "http://mybc",
    "serverInstance": "BC",
    "authentication": "Windows",
    
  5. Save the launch.json file.

You have now set up Visual Studio Code with the AL Language extension for Microsoft Dynamics 365 Business Central.

See Also

Running a Container-Based Development Environment
Working with Sandboxes and Entitlements
Sandbox Environments for Dynamics 365 Business Central Development
AL Development Environment