A week ago I’ve written a post explaining how to create a Dynamics 365 Business Central Docker container on Azure Container Instances (ACI) by using the new artifact way.
ACI permits you to have “container as a service” and so you can rapidly create and launch containerized applications in a serverless scenario. And when going totally serverless, a task that you could have the need to handle is the ability to spin-up a Docker container based on events that can occour in the cloud or on other systems.
As an example, imagine that when you insert a Customer record on your internal ERP system (obviously, it’s Dynamics 365 Business Central 😉 ) and you trigger an action called “Create test environment for this Customer“, a new Dynamics 365 Business Central Docker Container must be created on Azure Container Instances. This container must be created without deploying scripts or other things. How you can do that?
The answer can be: use Azure Logic App! You can create an action inside D365BC where you send a POST request to the Logic app endpoint using the AL HttpClient object by passing a JSON body with the parameters that defines the container you need to create.
With Azure Logic Apps and the Azure Container Instance connector, you can set up automated tasks and workflows that deploy and manage container groups. The Container Instance connector supports the following actions:
- Create or delete a container group
- Get the properties of a container group
- Get a list of container groups
- Get the logs of a container instance
To handle this scenario, I will create an HTTP-triggered Azure Logic App. This Logic App will receive a JSON object that contains the parameters for defining the Dynamics 365 Business Central Docker container to create, like the following:
When the HTTP request is received (with the above JSON body) from the Logic App endpoint, a new Create or update a container group action is triggered. This action receives the parameter from the body and must be configured in order to be able to create the Dynamics 365 Business Central container. The configuration is quite tricky and here I want to explain the parameters that must be configured to successfully create a Dynamics 365 Business Centra ACI container.
As a first step, we need to configure the basic parameters (like Azure subscription, resource group, location, container name, container’s image and resources):
Then, the other required parameters that must be configured are the environment variables required for the creation of a Dynamics 365 Business Central container:
Here I’m passing the artifactUrl variable (received from the JSON) because it’s needed in order to create the container (download the artifacts) and also ACEPT_EULA = Y and USESSL = N.
We need also to add parameters like Container Port Number and Container Port Protocol in order to expose the needed conatiner’s ports:
Then, you need to specify the container’s OS type (Windows), the DNS name and you need to add the Port Number parameters (for port mapping):
Last needed parameters are the Container Group IP address type and the ContainerGroup SKU.
The container’s creation on ACI requires a bit of time, so I’ve added an Until loop that waits until the Container Group state is equal to Succeeded:
Save the Azure Logic App.
What happens now?
If you send a POST http request to the Logic App endpoint by passing a JSON body like described above, you receive this response:
and the workflow defined in the Logic App is triggered:
If the Logic App is succeded, your ACI instance is provisioned:
and your Dynamics 365 Business Central Docker container spinned up by the Azure Logic app is ready to go:
Clean, low-code and fully serverless 😉
How do you publish apps to ACI BC environment and how do you update license?