Security change on December 1, 2026: TLS 1.2 will become the minimum standard for 365 business Print Agent. Details and system requirements
365 business development
PowerShell Module

Environments module

Module: businessdev.ALbuild.Environments  •  Tier: Licensed  •  Cmdlets: 4

The Environments module provisions and tears down demo/dev environments and cleans up expired ones. This is a licensed feature.

Licensing

Cmdlets in this module are part of a licensed tier and call Assert-ALbuildLicensed on entry. Without a valid ALbuild license they fail with clear remediation guidance. See Licensing & tiers.

Cmdlets in this module

CmdletDescription
Get-BcEnvironmentLists ALbuild-provisioned Business Central environments (containers).
New-BcEnvironmentProvisions a demo or developer Business Central environment (container) with Traefik routing (licensed).
Remove-BcEnvironmentRemoves an ALbuild Business Central environment and its Traefik configuration (licensed).
Remove-BcExpiredEnvironmentRemoves all expired ALbuild Business Central environments (licensed).

Get-BcEnvironment

Lists ALbuild-provisioned Business Central environments (containers).

Returns the containers tagged as ALbuild environments, with their metadata labels (type, owner, public URL, expiry) and whether they have expired.

Syntax

PowerShellCode
Get-BcEnvironment [-Name <String>] [-DockerExecutable <String>]

Parameters

ParameterTypeRequiredDescription
-NameStringNoOptional exact environment name filter.
-DockerExecutableStringNoThe Docker executable to use (default 'docker'). Default: 'docker'.

Output

PSCustomObject with Name, Type, Owner, Url, ExpiresAt, Expired, Running.


New-BcEnvironment

Provisions a demo or developer Business Central environment (container) with Traefik routing (licensed).

Creates a Business Central container tagged with environment metadata labels (expiry, owner, type) for label-based lifecycle management, and produces a Traefik v3 dynamic configuration routing to it (Subdomain or PathPrefix). Requires Windows + Docker and a valid ALbuild license.

Syntax

PowerShellCode
New-BcEnvironment -Name <String> -Domain <String> -Credential <PSCredential> [-ArtifactUrl <String>] [-Type <String>] [-Country <String>] [-Version <String>] [-Routing <String>] [-EnvironmentType <String>] [-ExpiresInDays <Int32>] [-OwnerEmail <String>] [-TraefikConfigFolder <String>] [-DockerExecutable <String>]

Parameters

ParameterTypeRequiredDescription
-NameStringYesEnvironment / container name.
-DomainStringYesBase domain for Traefik routing (e.g. businesscentral.example.com).
-CredentialPSCredentialYesContainer admin credential.
-ArtifactUrlStringNoThe BC artifact URL. If omitted, resolved from -Type/-Country/-Version.
-TypeStringNoArtifact type when resolving: Sandbox (default) or OnPrem. Allowed values: Sandbox, OnPrem. Default: 'Sandbox'.
-CountryStringNoArtifact country. Default 'w1'. Default: 'w1'.
-VersionStringNoOptional artifact version.
-RoutingStringNoTraefik routing mode: Subdomain (default) or PathPrefix. Allowed values: Subdomain, PathPrefix. Default: 'Subdomain'.
-EnvironmentTypeStringNoDemo (default) or Development. Allowed values: Demo, Development. Default: 'Demo'.
-ExpiresInDaysInt32NoLifetime in days (used for the expiry label). Default 7. Default: 7.
-OwnerEmailStringNoOwner email recorded as a label.
-TraefikConfigFolderStringNoFolder to write the Traefik dynamic configuration to. Default: ./traefik. Default: (Join-Path (Get-Location) 'traefik').
-DockerExecutableStringNoThe Docker executable to use (default 'docker'). Default: 'docker'.

Output

PSCustomObject describing the environment (Name, Url, ExpiresAt, Container, TraefikConfig).


Remove-BcEnvironment

Removes an ALbuild Business Central environment and its Traefik configuration (licensed).

Syntax

PowerShellCode
Remove-BcEnvironment -Name <String> [-TraefikConfigFolder <String>] [-DockerExecutable <String>]

Parameters

ParameterTypeRequiredDescription
-NameStringYesEnvironment / container name.
-TraefikConfigFolderStringNoFolder containing the environment's Traefik dynamic config (<Name>.json) to delete.
-DockerExecutableStringNoThe Docker executable to use (default 'docker'). No ConfirmImpact='High': ALbuild runs primarily non-interactively, where a High-impact prompt has no host UI and ShouldProcess throws a NullReferenceException. -WhatIf/-Confirm remain available. Default: 'docker'.

Remove-BcExpiredEnvironment

Removes all expired ALbuild Business Central environments (licensed).

Finds ALbuild environments whose expiry has passed and removes them (and their Traefik configuration). Intended to be run on a schedule.

Syntax

PowerShellCode
Remove-BcExpiredEnvironment [-TraefikConfigFolder <String>] [-DockerExecutable <String>]

Parameters

ParameterTypeRequiredDescription
-TraefikConfigFolderStringNoFolder containing the environments' Traefik dynamic configs to delete.
-DockerExecutableStringNoThe Docker executable to use (default 'docker'). Default: 'docker'.

Output

The names of the removed environments.


Last modified on