Container Appliance Landing Zone
br/innofactor:avm/ptn/lz/container-appliance:0.2.1
README
Container Appliance [Lz/ContainerAppliance]
Payload-agnostic container appliance. One resource group holds a VNet and subnet with an NSG, an optional NAT Gateway (or a subnet the caller brings), a user-assigned managed identity, a Key Vault, Recovery Services backup, Log Analytics with a data collection rule, alerting, a health workbook, a patch schedule, and Ubuntu hosts running Docker that start ONE compose stack supplied by the caller.
Three scale modes decide how many hosts there are and what happens when one fails: single (one VM, the default), activeStandby (two VMs, one data disk that follows the active host, a blob lease, an internal load balancer whose probe keeps the passive host out of service) and loadBalanced (a Flexible scale set behind an internal load balancer).
The module knows nothing about what it hosts. It accepts an already-rendered docker-compose.yml, a named set of Key Vault secrets, and a list of env files to derive from those secrets at boot, and it never parses any of them. A workload module (a second module that consumes this one) supplies the compose file, secrets, inbound ports and any resource its payload needs that every payload would not need.
What belongs here and what does not: anything that every payload needs lives in this module (network, VM and disks, identity, runtime secret store, backup, monitoring, patching, generic alerts). Anything that only one payload needs lives in that payload’s module.
See the Notes section for prerequisites, the payload contract and the operational constraints.
Navigation
Resource Types
| Resource Type | API Version |
|---|---|
Microsoft.Authorization/locks | 2020-05-01 |
Microsoft.Authorization/policyAssignments | 2024-04-01 |
Microsoft.Authorization/roleAssignments | 2022-04-01 |
Microsoft.Automanage/configurationProfileAssignments | 2022-05-04 |
Microsoft.Compute/disks | 2024-03-02 |
Microsoft.Compute/virtualMachines | 2024-07-01 |
Microsoft.Compute/virtualMachines/extensions | 2022-11-01 |
Microsoft.Compute/virtualMachineScaleSets | 2024-07-01 |
Microsoft.DevTestLab/schedules | 2018-09-15 |
Microsoft.GuestConfiguration/guestConfigurationAssignments | 2020-06-25 |
Microsoft.Insights/actionGroups | 2023-01-01 |
Microsoft.Insights/dataCollectionRuleAssociations | 2023-03-11 |
Microsoft.Insights/dataCollectionRules | 2023-03-11 |
Microsoft.Insights/diagnosticSettings | 2021-05-01-preview |
Microsoft.Insights/metricAlerts | 2018-03-01 |
Microsoft.Insights/scheduledQueryRules | 2025-01-01-preview |
Microsoft.Insights/workbooks | 2023-06-01 |
Microsoft.KeyVault/vaults | 2024-11-01 |
Microsoft.KeyVault/vaults/accessPolicies | 2024-11-01 |
Microsoft.KeyVault/vaults/keys | 2024-11-01 |
Microsoft.KeyVault/vaults/secrets | 2024-11-01 |
Microsoft.Maintenance/configurationAssignments | 2023-04-01 |
Microsoft.Maintenance/maintenanceConfigurations | 2023-04-01 |
Microsoft.ManagedIdentity/userAssignedIdentities | 2024-11-30 |
Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials | 2024-11-30 |
Microsoft.Network/loadBalancers | 2024-05-01 |
Microsoft.Network/natGateways | 2023-04-01 |
Microsoft.Network/networkInterfaces | 2024-05-01 |
Microsoft.Network/networkSecurityGroups | 2023-11-01 |
Microsoft.Network/privateEndpoints | 2023-11-01 |
Microsoft.Network/privateEndpoints | 2024-10-01 |
Microsoft.Network/privateEndpoints | 2024-05-01 |
Microsoft.Network/privateEndpoints/privateDnsZoneGroups | 2024-05-01 |
Microsoft.Network/privateEndpoints/privateDnsZoneGroups | 2023-11-01 |
Microsoft.Network/privateEndpoints/privateDnsZoneGroups | 2024-10-01 |
Microsoft.Network/publicIPAddresses | 2023-09-01 |
Microsoft.Network/publicIPAddresses | 2024-05-01 |
Microsoft.Network/publicIPPrefixes | 2023-09-01 |
Microsoft.Network/routeTables | 2024-05-01 |
Microsoft.Network/virtualNetworks | 2024-05-01 |
Microsoft.Network/virtualNetworks/subnets | 2024-05-01 |
Microsoft.Network/virtualNetworks/virtualNetworkPeerings | 2024-01-01 |
Microsoft.OperationalInsights/workspaces | 2025-02-01 |
Microsoft.OperationalInsights/workspaces/dataExports | 2025-02-01 |
Microsoft.OperationalInsights/workspaces/dataSources | 2025-02-01 |
Microsoft.OperationalInsights/workspaces/linkedServices | 2025-02-01 |
Microsoft.OperationalInsights/workspaces/linkedStorageAccounts | 2025-02-01 |
Microsoft.OperationalInsights/workspaces/savedSearches | 2025-02-01 |
Microsoft.OperationalInsights/workspaces/storageInsightConfigs | 2025-02-01 |
Microsoft.OperationalInsights/workspaces/tables | 2025-02-01 |
Microsoft.OperationsManagement/solutions | 2015-11-01-preview |
Microsoft.PolicyInsights/remediations | 2021-10-01 |
Microsoft.RecoveryServices/vaults | 2024-04-01 |
Microsoft.RecoveryServices/vaults/backupconfig | 2023-01-01 |
Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems | 2023-01-01 |
Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems | 2024-10-01 |
Microsoft.RecoveryServices/vaults/backupPolicies | 2024-10-01 |
Microsoft.RecoveryServices/vaults/backupstorageconfig | 2023-01-01 |
Microsoft.RecoveryServices/vaults/replicationAlertSettings | 2022-10-01 |
Microsoft.RecoveryServices/vaults/replicationFabrics | 2022-10-01 |
Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers | 2022-10-01 |
Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings | 2022-10-01 |
Microsoft.RecoveryServices/vaults/replicationPolicies | 2023-06-01 |
Microsoft.SecurityInsights/onboardingStates | 2024-03-01 |
Microsoft.Storage/storageAccounts | 2025-06-01 |
Microsoft.Storage/storageAccounts/blobServices | 2025-01-01 |
Microsoft.Storage/storageAccounts/blobServices/containers | 2025-01-01 |
Microsoft.Storage/storageAccounts/blobServices/containers/immutabilityPolicies | 2025-01-01 |
Microsoft.Storage/storageAccounts/fileServices | 2025-06-01 |
Microsoft.Storage/storageAccounts/fileServices/shares | 2025-01-01 |
Microsoft.Storage/storageAccounts/localUsers | 2025-06-01 |
Microsoft.Storage/storageAccounts/managementPolicies | 2025-06-01 |
Microsoft.Storage/storageAccounts/objectReplicationPolicies | 2025-01-01 |
Microsoft.Storage/storageAccounts/queueServices | 2025-06-01 |
Microsoft.Storage/storageAccounts/queueServices/queues | 2025-06-01 |
Microsoft.Storage/storageAccounts/tableServices | 2025-06-01 |
Microsoft.Storage/storageAccounts/tableServices/tables | 2025-06-01 |
Usage examples
The following section provides usage examples for the module, which were used to validate and deploy the module successfully. For a full reference, please review the module’s test folder in its repository.
Note: Each example lists all the required parameters first, followed by the rest - each in alphabetical order.
Note: To reference the module, please use the following syntax
br/innofactor:avm/ptn/lz/container-appliance:<version>.
- Active/standby with a switchover
- Bring your own subnet
- Using only defaults
- Load balanced, two hosts
- No data disk and a per-rule source
- Private registry with a Key Vault token
- WAF-aligned
Example 1: Active/standby with a switchover
This instance deploys two hosts in activeStandby mode: one data disk attached to the active host, a blob lease so only that host runs the stack, and an internal load balancer whose probe keeps the passive host out of service. After the second deployment (the idempotency pass) a deployment script writes a marker to the data disk, stops the active host’s stack and releases the lease, detaches the disk and attaches it to the standby, and asserts that the standby serves through the load balancer within five minutes with the marker intact. It then fails over from a dead host: it deallocates the host that is active now, so the lease is never released, force-detaches the disk from it and attaches the disk to the other host, and asserts that host takes the lease and serves with the marker intact. Both durations are deployment outputs. The dead host is started again afterwards, so the group is removed with every VM running.
via Bicep module
module containerAppliance 'br/innofactor:avm/ptn/lz/container-appliance:<version>' = {
name: 'containerApplianceDeployment'
params: {
// Required parameters
composeFileContent: '<composeFileContent>'
inboundAllowedCidr: '10.0.0.0/8'
inboundRules: [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
]
name: 'ctaprasg001'
sshPublicKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
vmSize: 'Standard_D2as_v5'
// Non-required parameters
dataDiskSizeGB: 32
enableBackup: false
enableKeyVaultPurgeProtection: false
enablePatchSchedule: false
instanceCount: 2
keyVaultName: '<keyVaultName>'
location: '<location>'
payloadPort: 8080
scaleMode: 'activeStandby'
tags: {
Environment: 'Test'
Workload: 'container-appliance'
}
vnetAddressPrefix: '10.242.0.0/24'
}
}via JSON parameters file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"composeFileContent": {
"value": "<composeFileContent>"
},
"inboundAllowedCidr": {
"value": "10.0.0.0/8"
},
"inboundRules": {
"value": [
{
"description": "Published network to the web port.",
"name": "AllowInboundToWebPort",
"port": 8080,
"protocol": "Tcp"
}
]
},
"name": {
"value": "ctaprasg001"
},
"sshPublicKey": {
"value": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test"
},
"vmSize": {
"value": "Standard_D2as_v5"
},
// Non-required parameters
"dataDiskSizeGB": {
"value": 32
},
"enableBackup": {
"value": false
},
"enableKeyVaultPurgeProtection": {
"value": false
},
"enablePatchSchedule": {
"value": false
},
"instanceCount": {
"value": 2
},
"keyVaultName": {
"value": "<keyVaultName>"
},
"location": {
"value": "<location>"
},
"payloadPort": {
"value": 8080
},
"scaleMode": {
"value": "activeStandby"
},
"tags": {
"value": {
"Environment": "Test",
"Workload": "container-appliance"
}
},
"vnetAddressPrefix": {
"value": "10.242.0.0/24"
}
}
}
via Bicep parameters file
using 'br/innofactor:avm/ptn/lz/container-appliance:<version>'
// Required parameters
param composeFileContent = '<composeFileContent>'
param inboundAllowedCidr = '10.0.0.0/8'
param inboundRules = [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
]
param name = 'ctaprasg001'
param sshPublicKey = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
param vmSize = 'Standard_D2as_v5'
// Non-required parameters
param dataDiskSizeGB = 32
param enableBackup = false
param enableKeyVaultPurgeProtection = false
param enablePatchSchedule = false
param instanceCount = 2
param keyVaultName = '<keyVaultName>'
param location = '<location>'
param payloadPort = 8080
param scaleMode = 'activeStandby'
param tags = {
Environment: 'Test'
Workload: 'container-appliance'
}
param vnetAddressPrefix = '10.242.0.0/24'
Example 2: Bring your own subnet
This instance deploys the container appliance into an empty subnet that the test creates, in a VNet that also carries a client subnet. The module creates no VNet, NSG or NAT Gateway of its own and asserts that the subnet is empty before it places a host. The second deployment proves the assertion tolerates the appliance’s own hosts. A client VM in the other subnet curls the appliance.
via Bicep module
module containerAppliance 'br/innofactor:avm/ptn/lz/container-appliance:<version>' = {
name: 'containerApplianceDeployment'
params: {
// Required parameters
composeFileContent: '<composeFileContent>'
inboundAllowedCidr: '10.0.0.0/8'
inboundRules: [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
]
name: 'ctaprbyo001'
sshPublicKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
vmSize: 'Standard_D2as_v5'
// Non-required parameters
dataDiskSizeGB: 32
enableBackup: false
enableKeyVaultPurgeProtection: false
existingSubnetResourceId: '<existingSubnetResourceId>'
keyVaultName: '<keyVaultName>'
location: '<location>'
tags: {
Environment: 'Test'
Workload: 'container-appliance'
}
}
}via JSON parameters file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"composeFileContent": {
"value": "<composeFileContent>"
},
"inboundAllowedCidr": {
"value": "10.0.0.0/8"
},
"inboundRules": {
"value": [
{
"description": "Published network to the web port.",
"name": "AllowInboundToWebPort",
"port": 8080,
"protocol": "Tcp"
}
]
},
"name": {
"value": "ctaprbyo001"
},
"sshPublicKey": {
"value": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test"
},
"vmSize": {
"value": "Standard_D2as_v5"
},
// Non-required parameters
"dataDiskSizeGB": {
"value": 32
},
"enableBackup": {
"value": false
},
"enableKeyVaultPurgeProtection": {
"value": false
},
"existingSubnetResourceId": {
"value": "<existingSubnetResourceId>"
},
"keyVaultName": {
"value": "<keyVaultName>"
},
"location": {
"value": "<location>"
},
"tags": {
"value": {
"Environment": "Test",
"Workload": "container-appliance"
}
}
}
}
via Bicep parameters file
using 'br/innofactor:avm/ptn/lz/container-appliance:<version>'
// Required parameters
param composeFileContent = '<composeFileContent>'
param inboundAllowedCidr = '10.0.0.0/8'
param inboundRules = [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
]
param name = 'ctaprbyo001'
param sshPublicKey = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
param vmSize = 'Standard_D2as_v5'
// Non-required parameters
param dataDiskSizeGB = 32
param enableBackup = false
param enableKeyVaultPurgeProtection = false
param existingSubnetResourceId = '<existingSubnetResourceId>'
param keyVaultName = '<keyVaultName>'
param location = '<location>'
param tags = {
Environment: 'Test'
Workload: 'container-appliance'
}
Example 3: Using only defaults
This instance deploys the container appliance with the minimum set of required parameters. It creates its own VNet, NAT Gateway, managed identity, Key Vault, Recovery Services vault, Log Analytics workspace and a monthly patch schedule, and runs a throwaway compose stack that serves a static page.
via Bicep module
module containerAppliance 'br/innofactor:avm/ptn/lz/container-appliance:<version>' = {
name: 'containerApplianceDeployment'
params: {
// Required parameters
composeFileContent: '<composeFileContent>'
inboundAllowedCidr: '10.0.0.0/8'
inboundRules: [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
]
name: 'ctaprmin001'
sshPublicKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
vmSize: 'Standard_D2as_v5'
// Non-required parameters
enableBackup: false
enableKeyVaultPurgeProtection: false
keyVaultName: '<keyVaultName>'
location: '<location>'
vnetAddressPrefix: '10.242.0.0/24'
}
}via JSON parameters file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"composeFileContent": {
"value": "<composeFileContent>"
},
"inboundAllowedCidr": {
"value": "10.0.0.0/8"
},
"inboundRules": {
"value": [
{
"description": "Published network to the web port.",
"name": "AllowInboundToWebPort",
"port": 8080,
"protocol": "Tcp"
}
]
},
"name": {
"value": "ctaprmin001"
},
"sshPublicKey": {
"value": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test"
},
"vmSize": {
"value": "Standard_D2as_v5"
},
// Non-required parameters
"enableBackup": {
"value": false
},
"enableKeyVaultPurgeProtection": {
"value": false
},
"keyVaultName": {
"value": "<keyVaultName>"
},
"location": {
"value": "<location>"
},
"vnetAddressPrefix": {
"value": "10.242.0.0/24"
}
}
}
via Bicep parameters file
using 'br/innofactor:avm/ptn/lz/container-appliance:<version>'
// Required parameters
param composeFileContent = '<composeFileContent>'
param inboundAllowedCidr = '10.0.0.0/8'
param inboundRules = [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
]
param name = 'ctaprmin001'
param sshPublicKey = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
param vmSize = 'Standard_D2as_v5'
// Non-required parameters
param enableBackup = false
param enableKeyVaultPurgeProtection = false
param keyVaultName = '<keyVaultName>'
param location = '<location>'
param vnetAddressPrefix = '10.242.0.0/24'
Example 4: Load balanced, two hosts
This instance deploys the container appliance in loadBalanced mode: a Flexible scale set of two stateless hosts behind an internal Standard load balancer. A client VM in the same subnet curls the load balancer address and expects the payload.
via Bicep module
module containerAppliance 'br/innofactor:avm/ptn/lz/container-appliance:<version>' = {
name: 'containerApplianceDeployment'
params: {
// Required parameters
composeFileContent: '<composeFileContent>'
inboundAllowedCidr: '10.0.0.0/8'
inboundRules: [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
]
name: 'ctaprlb001'
sshPublicKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
vmSize: 'Standard_D2as_v5'
// Non-required parameters
dataDiskSizeGB: 0
enableBackup: false
enableKeyVaultPurgeProtection: false
instanceCount: 2
keyVaultName: '<keyVaultName>'
location: '<location>'
payloadPort: 8080
scaleMode: 'loadBalanced'
tags: {
Environment: 'Test'
Workload: 'container-appliance'
}
vnetAddressPrefix: '10.242.0.0/24'
}
}via JSON parameters file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"composeFileContent": {
"value": "<composeFileContent>"
},
"inboundAllowedCidr": {
"value": "10.0.0.0/8"
},
"inboundRules": {
"value": [
{
"description": "Published network to the web port.",
"name": "AllowInboundToWebPort",
"port": 8080,
"protocol": "Tcp"
}
]
},
"name": {
"value": "ctaprlb001"
},
"sshPublicKey": {
"value": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test"
},
"vmSize": {
"value": "Standard_D2as_v5"
},
// Non-required parameters
"dataDiskSizeGB": {
"value": 0
},
"enableBackup": {
"value": false
},
"enableKeyVaultPurgeProtection": {
"value": false
},
"instanceCount": {
"value": 2
},
"keyVaultName": {
"value": "<keyVaultName>"
},
"location": {
"value": "<location>"
},
"payloadPort": {
"value": 8080
},
"scaleMode": {
"value": "loadBalanced"
},
"tags": {
"value": {
"Environment": "Test",
"Workload": "container-appliance"
}
},
"vnetAddressPrefix": {
"value": "10.242.0.0/24"
}
}
}
via Bicep parameters file
using 'br/innofactor:avm/ptn/lz/container-appliance:<version>'
// Required parameters
param composeFileContent = '<composeFileContent>'
param inboundAllowedCidr = '10.0.0.0/8'
param inboundRules = [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
]
param name = 'ctaprlb001'
param sshPublicKey = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
param vmSize = 'Standard_D2as_v5'
// Non-required parameters
param dataDiskSizeGB = 0
param enableBackup = false
param enableKeyVaultPurgeProtection = false
param instanceCount = 2
param keyVaultName = '<keyVaultName>'
param location = '<location>'
param payloadPort = 8080
param scaleMode = 'loadBalanced'
param tags = {
Environment: 'Test'
Workload: 'container-appliance'
}
param vnetAddressPrefix = '10.242.0.0/24'
Example 5: No data disk and a per-rule source
This instance deploys the container appliance for a payload that keeps no state worth restoring: dataDiskSizeGB is 0, so the VM has only its OS disk, and an inbound rule names its own source address prefix instead of using inboundAllowedCidr.
via Bicep module
module containerAppliance 'br/innofactor:avm/ptn/lz/container-appliance:<version>' = {
name: 'containerApplianceDeployment'
params: {
// Required parameters
composeFileContent: '<composeFileContent>'
inboundAllowedCidr: '10.0.0.0/8'
inboundRules: [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
{
description: 'A second source range for the same port.'
name: 'AllowInboundFromOperatorRange'
port: 8080
protocol: 'Tcp'
sourceAddressPrefix: '172.16.0.0/12'
}
]
name: 'ctaprnod001'
sshPublicKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
vmSize: 'Standard_D2as_v5'
// Non-required parameters
dataDiskSizeGB: 0
enableBackup: false
enableKeyVaultPurgeProtection: false
keyVaultName: '<keyVaultName>'
location: '<location>'
vnetAddressPrefix: '10.242.0.0/24'
}
}via JSON parameters file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"composeFileContent": {
"value": "<composeFileContent>"
},
"inboundAllowedCidr": {
"value": "10.0.0.0/8"
},
"inboundRules": {
"value": [
{
"description": "Published network to the web port.",
"name": "AllowInboundToWebPort",
"port": 8080,
"protocol": "Tcp"
},
{
"description": "A second source range for the same port.",
"name": "AllowInboundFromOperatorRange",
"port": 8080,
"protocol": "Tcp",
"sourceAddressPrefix": "172.16.0.0/12"
}
]
},
"name": {
"value": "ctaprnod001"
},
"sshPublicKey": {
"value": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test"
},
"vmSize": {
"value": "Standard_D2as_v5"
},
// Non-required parameters
"dataDiskSizeGB": {
"value": 0
},
"enableBackup": {
"value": false
},
"enableKeyVaultPurgeProtection": {
"value": false
},
"keyVaultName": {
"value": "<keyVaultName>"
},
"location": {
"value": "<location>"
},
"vnetAddressPrefix": {
"value": "10.242.0.0/24"
}
}
}
via Bicep parameters file
using 'br/innofactor:avm/ptn/lz/container-appliance:<version>'
// Required parameters
param composeFileContent = '<composeFileContent>'
param inboundAllowedCidr = '10.0.0.0/8'
param inboundRules = [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
{
description: 'A second source range for the same port.'
name: 'AllowInboundFromOperatorRange'
port: 8080
protocol: 'Tcp'
sourceAddressPrefix: '172.16.0.0/12'
}
]
param name = 'ctaprnod001'
param sshPublicKey = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
param vmSize = 'Standard_D2as_v5'
// Non-required parameters
param dataDiskSizeGB = 0
param enableBackup = false
param enableKeyVaultPurgeProtection = false
param keyVaultName = '<keyVaultName>'
param location = '<location>'
param vnetAddressPrefix = '10.242.0.0/24'
Example 6: Private registry with a Key Vault token
This instance pulls its payload image from a private registry (ghcr.io) by digest, using the keyVaultToken registry mode: a read-only token is stored in the appliance Key Vault, and the agent reads it with the VM identity and logs in only while it pulls. The test supplies the token from the CI Key Vault (secret CI-ghcrReadToken) and fails at validation with the parameter name when it is missing. A client VM curls the payload’s /ping endpoint.
via Bicep module
module containerAppliance 'br/innofactor:avm/ptn/lz/container-appliance:<version>' = {
name: 'containerApplianceDeployment'
params: {
// Required parameters
composeFileContent: '<composeFileContent>'
inboundAllowedCidr: '10.0.0.0/8'
inboundRules: [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
]
name: 'ctaprprg001'
sshPublicKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
vmSize: 'Standard_D2as_v5'
// Non-required parameters
containerRegistry: {
mode: 'keyVaultToken'
server: 'ghcr.io'
tokenSecretName: 'registry-token'
}
enableBackup: false
enableKeyVaultPurgeProtection: false
keyVaultName: '<keyVaultName>'
keyVaultSecrets: [
{
contentType: 'Read-only registry token'
name: 'registry-token'
value: '<value>'
}
]
location: '<location>'
vnetAddressPrefix: '10.242.0.0/24'
}
}via JSON parameters file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"composeFileContent": {
"value": "<composeFileContent>"
},
"inboundAllowedCidr": {
"value": "10.0.0.0/8"
},
"inboundRules": {
"value": [
{
"description": "Published network to the web port.",
"name": "AllowInboundToWebPort",
"port": 8080,
"protocol": "Tcp"
}
]
},
"name": {
"value": "ctaprprg001"
},
"sshPublicKey": {
"value": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test"
},
"vmSize": {
"value": "Standard_D2as_v5"
},
// Non-required parameters
"containerRegistry": {
"value": {
"mode": "keyVaultToken",
"server": "ghcr.io",
"tokenSecretName": "registry-token"
}
},
"enableBackup": {
"value": false
},
"enableKeyVaultPurgeProtection": {
"value": false
},
"keyVaultName": {
"value": "<keyVaultName>"
},
"keyVaultSecrets": {
"value": [
{
"contentType": "Read-only registry token",
"name": "registry-token",
"value": "<value>"
}
]
},
"location": {
"value": "<location>"
},
"vnetAddressPrefix": {
"value": "10.242.0.0/24"
}
}
}
via Bicep parameters file
using 'br/innofactor:avm/ptn/lz/container-appliance:<version>'
// Required parameters
param composeFileContent = '<composeFileContent>'
param inboundAllowedCidr = '10.0.0.0/8'
param inboundRules = [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
]
param name = 'ctaprprg001'
param sshPublicKey = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
param vmSize = 'Standard_D2as_v5'
// Non-required parameters
param containerRegistry = {
mode: 'keyVaultToken'
server: 'ghcr.io'
tokenSecretName: 'registry-token'
}
param enableBackup = false
param enableKeyVaultPurgeProtection = false
param keyVaultName = '<keyVaultName>'
param keyVaultSecrets = [
{
contentType: 'Read-only registry token'
name: 'registry-token'
value: '<value>'
}
]
param location = '<location>'
param vnetAddressPrefix = '10.242.0.0/24'
Example 7: WAF-aligned
This instance deploys the container appliance in alignment with the best practices of the Azure Well-Architected Framework: CanNotDelete locks on each stateful resource and deliberately NO resource-group lock (a resource-group lock stops Azure Resource Manager grooming deployment history and eventually fails every deployment), a pinned availability zone, an alert email receiver so the alerts reach someone, and a secret delivered to the VM through an env file read from its own Key Vault.
via Bicep module
module containerAppliance 'br/innofactor:avm/ptn/lz/container-appliance:<version>' = {
name: 'containerApplianceDeployment'
params: {
// Required parameters
composeFileContent: '<composeFileContent>'
inboundAllowedCidr: '10.0.0.0/8'
inboundRules: [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
]
name: 'ctaprxwaf001'
sshPublicKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
vmSize: 'Standard_D2as_v5'
// Non-required parameters
alertEmailAddresses: [
'platform-alerts@example.com'
]
availabilityZone: 1
dataDiskSizeGB: 128
enablePatchSchedule: true
envFiles: [
{
fileName: '.env.web'
variables: [
{
secretName: 'test-secret'
variableName: 'TEST_SECRET'
}
]
}
]
keyVaultName: '<keyVaultName>'
keyVaultSecrets: [
{
contentType: 'Throwaway test value'
name: 'test-secret'
value: '<value>'
}
]
location: '<location>'
protectStatefulResources: true
tags: {
Environment: 'Test'
Workload: 'container-appliance'
}
vnetAddressPrefix: '10.242.0.0/24'
}
}via JSON parameters file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"composeFileContent": {
"value": "<composeFileContent>"
},
"inboundAllowedCidr": {
"value": "10.0.0.0/8"
},
"inboundRules": {
"value": [
{
"description": "Published network to the web port.",
"name": "AllowInboundToWebPort",
"port": 8080,
"protocol": "Tcp"
}
]
},
"name": {
"value": "ctaprxwaf001"
},
"sshPublicKey": {
"value": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test"
},
"vmSize": {
"value": "Standard_D2as_v5"
},
// Non-required parameters
"alertEmailAddresses": {
"value": [
"platform-alerts@example.com"
]
},
"availabilityZone": {
"value": 1
},
"dataDiskSizeGB": {
"value": 128
},
"enablePatchSchedule": {
"value": true
},
"envFiles": {
"value": [
{
"fileName": ".env.web",
"variables": [
{
"secretName": "test-secret",
"variableName": "TEST_SECRET"
}
]
}
]
},
"keyVaultName": {
"value": "<keyVaultName>"
},
"keyVaultSecrets": {
"value": [
{
"contentType": "Throwaway test value",
"name": "test-secret",
"value": "<value>"
}
]
},
"location": {
"value": "<location>"
},
"protectStatefulResources": {
"value": true
},
"tags": {
"value": {
"Environment": "Test",
"Workload": "container-appliance"
}
},
"vnetAddressPrefix": {
"value": "10.242.0.0/24"
}
}
}
via Bicep parameters file
using 'br/innofactor:avm/ptn/lz/container-appliance:<version>'
// Required parameters
param composeFileContent = '<composeFileContent>'
param inboundAllowedCidr = '10.0.0.0/8'
param inboundRules = [
{
description: 'Published network to the web port.'
name: 'AllowInboundToWebPort'
port: 8080
protocol: 'Tcp'
}
]
param name = 'ctaprxwaf001'
param sshPublicKey = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
param vmSize = 'Standard_D2as_v5'
// Non-required parameters
param alertEmailAddresses = [
'platform-alerts@example.com'
]
param availabilityZone = 1
param dataDiskSizeGB = 128
param enablePatchSchedule = true
param envFiles = [
{
fileName: '.env.web'
variables: [
{
secretName: 'test-secret'
variableName: 'TEST_SECRET'
}
]
}
]
param keyVaultName = '<keyVaultName>'
param keyVaultSecrets = [
{
contentType: 'Throwaway test value'
name: 'test-secret'
value: '<value>'
}
]
param location = '<location>'
param protectStatefulResources = true
param tags = {
Environment: 'Test'
Workload: 'container-appliance'
}
param vnetAddressPrefix = '10.242.0.0/24'
Parameters
Required parameters
| Parameter | Type | Description |
|---|---|---|
composeFileContent | string | Full contents of the docker-compose.yml this appliance runs, already rendered by the caller — image tags, environment variables, ports, everything payload-specific. This module only base64-encodes it and writes it to disk idempotently; it does not parse, validate, or know anything about what it contains. Its content is visible in the deployment history, so put no secret in it: use keyVaultSecrets and envFiles. |
inboundAllowedCidr | string | CIDR allowed inbound to the appliance. It is the source of every rule in inboundRules that does not name its own sourceAddressPrefix. |
inboundRules | array | The inbound NSG rules to open, one per published port. Each rule’s source is inboundAllowedCidr unless the rule names its own sourceAddressPrefix. Generic by design — this module does not know what is listening on any of these ports; the workload module supplies the list. Example: An explicit deny-all-else rule is always added beneath whatever is listed here, documenting intent above the NSG’s implicit deny. |
name | string | Short name used to derive every resource name in this module (NSG, VNet, VM, Key Vault, etc). Lowercase alphanumeric and hyphens, kept short — several derived names (e.g. the Key Vault) have tight length limits. |
sshPublicKey | string | SSH public key for the admin account. Password authentication is disabled. |
vmSize | string | VM size. Vertical SKU is the only axis this module scales on: one instance is the deliberate architecture, not a limitation. Avoid burstable (B-series) SKUs for any workload with a bursty, CPU-heavy profile: credit exhaustion throttles silently rather than failing loudly. |
Conditional parameters
| Parameter | Type | Description |
|---|---|---|
existingIdentityPrincipalId | string | Required if createNewManagedIdentity is false. Principal ID of the existing identity — used only for the manualStepsRequiredForReuse output; no new role is auto-granted to it. |
existingIdentityResourceId | string | Required if createNewManagedIdentity is false. Resource ID of the existing identity to attach. |
vnetAddressPrefix | string | Required if existingSubnetResourceId is empty. Address space for this appliance’s own VNet, created inside this resource group. Must not overlap anything it may later be peered to. This module creates and owns the VNet and subnet rather than joining a caller-supplied one: the bootstrap script needs egress DURING VM provisioning to install Docker and pull container images, so an appliance with no egress at that moment fails to deploy — “join an existing subnet, and hope it has a route to the internet” is not a dependency this module takes on. |
Optional parameters
| Parameter | Type | Description |
|---|---|---|
activeInstance | int | activeStandby only: which host (1 or 2) the data disk is attached to when the template is deployed. After a switchover, redeploy with the number of the host that now holds the disk, otherwise the template attaches the disk to the other one. |
additionalSyslogFacilities | array | Extra syslog facilities to collect at EVERY level, Debug included, on top of the system facilities collected at Warning and above. For a payload’s own health records (e.g. local0), which are routinely Info. |
adminUsername | string | Local admin username on the appliance VM. |
alertEmailAddresses | array | Email addresses added to the action group, using the common alert schema. A service desk mailbox (for example a Jira Service Management email channel) turns each notification into a ticket. |
applianceSubnetNewBits | int | Prefix length of the appliance subnet, carved as the first subnet of vnetAddressPrefix with cidrSubnet(vnetAddressPrefix, applianceSubnetNewBits, 0). Despite the name it is a prefix length, not a count of new bits: 27 is a /27 (32 addresses), one VM with headroom for a future second NIC. |
automaticRepairAction | string | loadBalanced only: what Azure does to a host that the Application Health probe reports unhealthy, after automaticRepairGracePeriod.Restart (default): restart the VM. The OS disk, and so anything the payload keeps on it (a mail queue, say), survives.Replace: delete the VM and create a new one. Anything on the OS disk is lost.Reimage: reimage the OS disk. Anything on it is lost.See ADR 19. |
automaticRepairGracePeriod | string | loadBalanced only: how long a new or repaired host may report unhealthy before it is repaired, as an ISO 8601 duration between PT10M and PT90M. |
availabilityZone | int | Availability zone for the VM, its disks and (if created) the NAT Gateway and its public IP. Default 1. A subscription can be barred from a size in some zones and not others —
zone — so this is a parameter rather than a constant. |
composeDirectoryName | string | Directory name (under /opt/{name}/) the compose file and env files are written to. |
containerRegistry | object | How the hosts authenticate to the container registry that serves the payload images.anonymous (default): no login.managedIdentity: the VM identity logs in. Pass registryResourceId to have this module grant it AcrPull on the registry; otherwise grant it yourself.keyVaultToken: docker login with the secret named tokenSecretName, which must be one of keyVaultSecrets. tokenUsername defaults to the all-zero ACR token user.Personal access tokens are not an accepted credential. See ADR 0010. |
containerRestartAlertThreshold | int | The container-restart alert fires when containers restart more than this many times in 15 minutes. |
createNatGateway | bool | Create a NAT Gateway in this resource group for outbound egress, and associate it to the appliance’s own subnet. Default true. Set false only if this VNet will be connected to a hub that already provides egress — understand that trade before flipping it: a NAT Gateway created but left unassociated is worse than none (it bills, and looks like egress is handled when it is not), and a hub with a secured/forced-tunnelled default route can silently black-hole this appliance’s own outbound traffic if the route table is not scoped correctly. |
createNewManagedIdentity | bool | Default TRUE: create a new user-assigned identity scoped to this appliance, granted only the minimum this module itself needs (its own Key Vault). The customer/operator then grants it write access to whatever the workload is meant to manage, as a separate, their-own decision — this module cannot know that scope and does not attempt to. Set false to attach an EXISTING identity instead (zero RBAC delta against its already-accumulated grants). Attaching an identity from a different subscription than this one is believed to work within a single tenant but is UNPROVEN. |
dataDirectoryName | string | Directory name (under /opt/{name}/) the dedicated data disk is mounted at (or, with dataDiskSizeGB 0, simply created at). The caller’s compose file should bind-mount this path for whatever state its payload needs to survive a VM reimage or redeploy. |
dataDiskSizeGB | int | Size in GB of the dedicated data disk mounted at /opt/{name}/{dataDirectoryName}. Separate from the OS disk so it can be snapshotted, resized and restored independently, and survives an OS reimage. 0 creates no data disk: the directory then lives on the OS disk, for a payload that keeps no state worth restoring. |
defaultRouteNextHopIpAddress | string | Next-hop IP for a 0.0.0.0/0 route on the appliance subnet — a hub firewall or other network virtual appliance. Empty (the default) creates no route table. When set, the subnet egresses through that appliance, so createNatGateway should be false: a user-defined default route to an appliance takes precedence over a NAT Gateway, which would then bill for nothing. The appliance at that address must already permit the bootstrap’s endpoints, because the bootstrap runs during VM provisioning. |
dnsServers | array | Custom DNS servers for the appliance VNet, e.g. a hub firewall DNS proxy. Empty uses Azure-provided DNS. |
drainCommands | array | Shell commands that quiesce the payload before its stack stops on a switchover, a scale-in or a shutdown. They run in the compose directory as root, after the host has left the load balancer pool, and are given up to five minutes. For example flushing a queue, or waiting until no operation is running. |
enableBackup | bool | Back up the VMs with Azure Backup (a Recovery Services vault and a daily policy). Default true, and it should stay true for anything that keeps state. Turn it off only for throwaway deployments such as tests: the vault keeps deleted backup items in soft delete for 14 days and soft delete cannot be switched off on it, so removing a deployment whose VMs were backed up can leave the resource group undeletable for that long. loadBalanced has no VM backup either way. |
enableKeyVaultPurgeProtection | bool | Purge protection on the Key Vault. Default true, which is the WAF recommendation and what production should use. Turn it off only for throwaway deployments (tests): a purge-protected vault cannot be purged after it is deleted, so its name stays reserved for the retention period. |
enablePatchSchedule | bool | Attach the VM to the patch window above. False leaves patching to Azure, at times Azure chooses. |
enableTelemetry | bool | Enable/Disable usage telemetry for module. |
envFiles | array | Env files to materialise on the host from the secrets above, before the compose stack starts. Each entry names a file (written under composeDirectoryName) and a list of VAR_NAME= az CLI on the box, umask 177 before any file is created, each file chmod 600 immediately after. |
existingSubnetResourceId | string | Resource ID of an existing subnet to place the appliance in, instead of creating a VNet, NSG, NAT Gateway and route table. The subnet must be dedicated and empty: the deployment fails with “appliance requires a dedicated empty subnet” when anything other than this appliance’s own hosts and load balancer sits in it. The module changes nothing about that subnet, so it is the caller’s to provide: egress to the Docker and Ubuntu repositories and the container registry during provisioning, the Microsoft.KeyVault service endpoint (and Microsoft.Storage for activeStandby), and an NSG that allows the inbound ports and, for the load-balanced modes, the AzureLoadBalancer probe. inboundRules, inboundAllowedCidr, createNatGateway, defaultRouteNextHopIpAddress, dnsServers and virtualNetworkPeerings then have no effect. |
hostPrivateIpAddress | string | Static private IP address for the first appliance VM (single and activeStandby), inside the appliance subnet. Empty uses cidrHost(the appliance subnet, 4), the first usable address, for a subnet this module creates, and a dynamic address in a subnet the caller brings. The second activeStandby host takes the next address. Not used by loadBalanced, whose hosts are dynamic: callers use applianceAddress. |
instanceCount | int | Number of hosts. single: 1. activeStandby: 2. loadBalanced: 1 or more. Every host takes an address in the appliance subnet, so a large loadBalanced count needs a bigger subnet: lower applianceSubnetNewBits (a /27 holds about 26 hosts). |
itsmWebhookUri | string | ITSM webhook URI for the action group. |
keyVaultName | string | Name of this module’s Key Vault. Empty (the default) derives a deterministic name from name and the resource group. Set it when the derived name is taken, for example by a vault that was deleted with purge protection on and so cannot be purged: a purge-protected vault keeps its name for the whole retention period (90 days). |
keyVaultSecrets | array | Secrets to store in this module’s own Key Vault. Generic name/value/contentType triples — this module does not know or care what any of them are for. |
location | string | Location for all Resources. |
lock | object | A lock to apply to the whole resource group. NOT recommended: a CanNotDelete lock on the group stops Azure Resource Manager grooming deployment history and eventually fails every deployment into it. Leave unset and use protectStatefulResources instead. |
maintenanceWindow | object | Monthly in-guest patch window for the VM (Azure Update Manager). Installs Linux Critical and Security updates and reboots only if required. Null (the default) uses Friday after the third Tuesday of the month (ten days after Patch Tuesday). It is a dedicated schedule on purpose: check that any estate-wide schedule you might attach the VM to actually includes the Linux Critical and Security classifications — some include only “Other”, so a Linux VM attached to them is never security-patched. Used only when enablePatchSchedule is true. |
payloadPort | int | TCP port the internal load balancer probes and forwards. Required for activeStandby and loadBalanced; the passive activeStandby host never listens on it, which is what keeps it out of service. |
postComposeCommands | array | Extra shell commands run after docker compose up -d (e.g. a one-off payload-specific bootstrap action). Empty by default. |
preComposeCommands | array | Extra shell commands run before the compose file is written (e.g. installing an extra apt package one specific payload needs). Empty by default — most payloads need nothing here; treat a long list here as a signal the module’s interface is missing a first-class parameter. |
protectStatefulResources | bool | Put a CanNotDelete lock on each resource that holds state: the VM, its OS and data disks, the Key Vault, the Recovery Services vault and the Log Analytics workspace this module creates. Resource-level on purpose. A CanNotDelete lock on the resource GROUP also stops Azure Resource Manager deleting the group’s old deployment records, so the group walks to the 800-deployment ceiling and every deployment into it fails. Locks on the resources protect the same data without blocking that. |
roleAssignments | array | Additional role assignments to grant on this resource group, beyond the identity grants this module manages itself via createNewManagedIdentity. |
scaleMode | string | How many hosts there are and what happens when one fails. The mode decides the update and failover rule, not just the host count.single (default): one VM. State lives on its data disk; restore from backup. No load balancer. applianceAddress is the VM.activeStandby: two VMs in one zone, ONE data disk attached to the active host, a blob lease so only the host holding it runs the stack, and an internal load balancer whose probe on payloadPort keeps the passive host (stack stopped) out of service. Switchover is a control-plane operation: stop and release on the active host, detach and attach the disk, and the standby takes over. See ADR 0009 and ADR 0011.loadBalanced: a Flexible-orchestration scale set of instanceCount stateless hosts behind an internal load balancer. No data disk and no VM backup. Hosts are patched by Azure’s automatic guest patching (Critical and Security, in batches, availability first) on the platform’s schedule, so enablePatchSchedule and maintenanceWindow do not apply. |
scaleSetZones | array | loadBalanced only: availability zones the scale set spreads across, for example [1, 2, 3]. Empty uses availabilityZone alone. A subscription can be barred from a size in some zones, so spread is opt-in. |
tags | object | Tags applied to every resource this module creates. |
virtualNetworkPeerings | array | VNet peerings, in the AVM virtual-network peerings shape. Empty (thedefault) peers nothing. A peering with remotePeeringEnabled also writes the remote side, which is a write OUTSIDE this resource group — the one deliberate exception to this module owning only its own group, and opt-in for exactly that reason. It needs peer rights on the remote VNet, and a Managed Application deployment cannot use it. |
workspaceResourceId | string | Resource ID of an existing Log Analytics Workspace. If not provided, a new one is created in this resource group — self-contained. |
Parameter: composeFileContent
Full contents of the docker-compose.yml this appliance runs, already
rendered by the caller — image tags, environment variables, ports, everything payload-specific.
This module only base64-encodes it and writes it to disk idempotently; it does not parse, validate,
or know anything about what it contains. Its content is visible in the deployment history, so put no
secret in it: use keyVaultSecrets and envFiles.
- Required: Yes
- Type: string
Parameter: inboundAllowedCidr
CIDR allowed inbound to the appliance. It is the source of every rule in inboundRules that does not name its own sourceAddressPrefix.
- Required: Yes
- Type: string
Parameter: inboundRules
The inbound NSG rules to open, one per published port. Each rule’s source is
inboundAllowedCidr unless the rule names its own sourceAddressPrefix. Generic by design — this module
does not know what is listening on any of these ports; the workload module supplies the list.
Example: [{ name: 'AllowInboundToWebPort', description: '...', port: 4141, protocol: 'Tcp' }].
An explicit deny-all-else rule is always added beneath whatever is listed here, documenting intent
above the NSG’s implicit deny.
- Required: Yes
- Type: array
Required parameters
| Parameter | Type | Description |
|---|---|---|
description | string | NSG rule description. At most 140 characters — ARM rejects longer ones at deploy time, not compile time, without this. |
name | string | NSG rule name. |
port | int | Destination port to allow. |
protocol | string | Protocol, e.g. Tcp. |
Optional parameters
| Parameter | Type | Description |
|---|---|---|
sourceAddressPrefix | string | Source address prefix for this rule. Defaults to inboundAllowedCidr. |
Parameter: inboundRules.description
NSG rule description. At most 140 characters — ARM rejects longer ones at deploy time, not compile time, without this.
- Required: Yes
- Type: string
Parameter: inboundRules.name
NSG rule name.
- Required: Yes
- Type: string
Parameter: inboundRules.port
Destination port to allow.
- Required: Yes
- Type: int
Parameter: inboundRules.protocol
Protocol, e.g. Tcp.
- Required: Yes
- Type: string
Parameter: inboundRules.sourceAddressPrefix
Source address prefix for this rule. Defaults to inboundAllowedCidr.
- Required: No
- Type: string
Parameter: name
Short name used to derive every resource name in this module (NSG, VNet, VM, Key Vault, etc). Lowercase alphanumeric and hyphens, kept short — several derived names (e.g. the Key Vault) have tight length limits.
- Required: Yes
- Type: string
Parameter: sshPublicKey
SSH public key for the admin account. Password authentication is disabled.
- Required: Yes
- Type: string
Parameter: vmSize
VM size. Vertical SKU is the only axis this module scales on: one instance is
the deliberate architecture, not a limitation. Avoid burstable (B-series) SKUs for any workload with
a bursty, CPU-heavy profile: credit exhaustion throttles silently rather than failing loudly.
- Required: Yes
- Type: string
Parameter: existingIdentityPrincipalId
Required if createNewManagedIdentity is false. Principal ID of the existing identity — used only for the manualStepsRequiredForReuse output; no new role is auto-granted to it.
- Required: No
- Type: string
- Default:
''
Parameter: existingIdentityResourceId
Required if createNewManagedIdentity is false. Resource ID of the existing identity to attach.
- Required: No
- Type: string
- Default:
''
Parameter: vnetAddressPrefix
Required if existingSubnetResourceId is empty. Address space for this appliance’s own VNet, created inside this resource
group. Must not overlap anything it may later be peered to. This module creates and owns the VNet
and subnet rather than joining a caller-supplied one: the bootstrap script needs egress DURING VM
provisioning to install Docker and pull container images, so an appliance with no egress at that
moment fails to deploy — “join an existing subnet, and hope it has a route to the internet” is not
a dependency this module takes on.
- Required: No
- Type: string
- Default:
''
Parameter: activeInstance
activeStandby only: which host (1 or 2) the data disk is attached to when the template is deployed. After a switchover, redeploy with the number of the host that now holds the disk, otherwise the template attaches the disk to the other one.
- Required: No
- Type: int
- Default:
1 - Allowed:
[ 1 2 ]
Parameter: additionalSyslogFacilities
Extra syslog facilities to collect at EVERY level, Debug included, on top of the system facilities collected at Warning and above. For a payload’s own health records (e.g. local0), which are routinely Info.
- Required: No
- Type: array
- Default:
[]
Parameter: adminUsername
Local admin username on the appliance VM.
- Required: No
- Type: string
- Default:
'applianceadmin'
Parameter: alertEmailAddresses
Email addresses added to the action group, using the common alert schema. A service desk mailbox (for example a Jira Service Management email channel) turns each notification into a ticket.
- Required: No
- Type: array
- Default:
[]
Parameter: applianceSubnetNewBits
Prefix length of the appliance subnet, carved as the first subnet of vnetAddressPrefix with cidrSubnet(vnetAddressPrefix, applianceSubnetNewBits, 0). Despite the name it is a prefix length, not a count of new bits: 27 is a /27 (32 addresses), one VM with headroom for a future second NIC.
- Required: No
- Type: int
- Default:
27
Parameter: automaticRepairAction
loadBalanced only: what Azure does to a host that the Application Health probe reports unhealthy, after automaticRepairGracePeriod.
Restart (default): restart the VM. The OS disk, and so anything the payload keeps on it (a mail queue, say), survives.Replace: delete the VM and create a new one. Anything on the OS disk is lost.Reimage: reimage the OS disk. Anything on it is lost.See ADR 19.
- Required: No
- Type: string
- Default:
'Restart' - Allowed:
[ 'Reimage' 'Replace' 'Restart' ]
Parameter: automaticRepairGracePeriod
loadBalanced only: how long a new or repaired host may report unhealthy before it is repaired, as an ISO 8601 duration between PT10M and PT90M.
- Required: No
- Type: string
- Default:
'PT30M'
Parameter: availabilityZone
Availability zone for the VM, its disks and (if created) the NAT Gateway and
its public IP. Default 1. A subscription can be barred from a size in some zones and not others —
az vm list-skus -l <region> --resource-type virtualMachines shows NotAvailableForSubscription per
zone — so this is a parameter rather than a constant.
- Required: No
- Type: int
- Default:
1 - Allowed:
[ 1 2 3 ]
Parameter: composeDirectoryName
Directory name (under /opt/{name}/) the compose file and env files are written to.
- Required: No
- Type: string
- Default:
'compose'
Parameter: containerRegistry
How the hosts authenticate to the container registry that serves the payload images.
anonymous (default): no login.managedIdentity: the VM identity logs in. Pass registryResourceId to have this module grant it AcrPull on the registry; otherwise grant it yourself.keyVaultToken: docker login with the secret named tokenSecretName, which must be one of keyVaultSecrets. tokenUsername defaults to the all-zero ACR token user.Personal access tokens are not an accepted credential. See ADR 0010.
- Required: No
- Type: object
- Default:
{ mode: 'anonymous' server: '' }
Required parameters
| Parameter | Type | Description |
|---|---|---|
mode | string | How to authenticate: anonymous, managedIdentity or keyVaultToken. |
server | string | Registry server name, for example contoso.azurecr.io. Empty with mode anonymous. |
Conditional parameters
| Parameter | Type | Description |
|---|---|---|
tokenSecretName | string | Required if mode is keyVaultToken: name of the Key Vault secret (one of keyVaultSecrets) holding the registry token. |
Optional parameters
| Parameter | Type | Description |
|---|---|---|
registryResourceId | string | managedIdentity only: resource ID of the Azure Container Registry, to grant the VM identity AcrPull on it. |
tokenUsername | string | keyVaultToken only: the user name that goes with the token. |
Parameter: containerRegistry.mode
How to authenticate: anonymous, managedIdentity or keyVaultToken.
- Required: Yes
- Type: string
- Allowed:
[ 'anonymous' 'keyVaultToken' 'managedIdentity' ]
Parameter: containerRegistry.server
Registry server name, for example contoso.azurecr.io. Empty with mode anonymous.
- Required: Yes
- Type: string
Parameter: containerRegistry.tokenSecretName
Required if mode is keyVaultToken: name of the Key Vault secret (one of keyVaultSecrets) holding the registry token.
- Required: No
- Type: string
Parameter: containerRegistry.registryResourceId
managedIdentity only: resource ID of the Azure Container Registry, to grant the VM identity AcrPull on it.
- Required: No
- Type: string
Parameter: containerRegistry.tokenUsername
keyVaultToken only: the user name that goes with the token.
- Required: No
- Type: string
Parameter: containerRestartAlertThreshold
The container-restart alert fires when containers restart more than this many times in 15 minutes.
- Required: No
- Type: int
- Default:
3 - MinValue: 1
Parameter: createNatGateway
Create a NAT Gateway in this resource group for outbound egress, and
associate it to the appliance’s own subnet. Default true. Set false only if this VNet will be
connected to a hub that already provides egress — understand that trade before flipping it: a NAT
Gateway created but left unassociated is worse than none (it bills, and looks like egress is
handled when it is not), and a hub with a secured/forced-tunnelled default route can silently
black-hole this appliance’s own outbound traffic if the route table is not scoped correctly.
- Required: No
- Type: bool
- Default:
True - MinValue: 1
Parameter: createNewManagedIdentity
Default TRUE: create a new user-assigned identity scoped to this
appliance, granted only the minimum this module itself needs (its own Key Vault). The
customer/operator then grants it write access to whatever the workload is meant to manage, as a
separate, their-own decision — this module cannot know that scope and does not attempt to.
Set false to attach an EXISTING identity instead (zero RBAC delta against its already-accumulated
grants). Attaching an identity from a different subscription than this one is believed to work
within a single tenant but is UNPROVEN.
- Required: No
- Type: bool
- Default:
True - MinValue: 1
Parameter: dataDirectoryName
Directory name (under /opt/{name}/) the dedicated data disk is mounted at (or, with dataDiskSizeGB 0, simply created at). The caller’s compose file should bind-mount this path for whatever state its payload needs to survive a VM reimage or redeploy.
- Required: No
- Type: string
- Default:
'data' - MinValue: 1
Parameter: dataDiskSizeGB
Size in GB of the dedicated data disk mounted at /opt/{name}/{dataDirectoryName}. Separate from the OS disk so it can be snapshotted, resized and restored independently, and survives an OS reimage. 0 creates no data disk: the directory then lives on the OS disk, for a payload that keeps no state worth restoring.
- Required: No
- Type: int
- Default:
128 - MinValue: 0
Parameter: defaultRouteNextHopIpAddress
Next-hop IP for a 0.0.0.0/0 route on the appliance subnet — a hub firewall
or other network virtual appliance. Empty (the default) creates no route table. When set, the
subnet egresses through that appliance, so createNatGateway should be false: a user-defined
default route to an appliance takes precedence over a NAT Gateway, which would then bill for
nothing. The appliance at that address must already permit the bootstrap’s endpoints, because
the bootstrap runs during VM provisioning.
- Required: No
- Type: string
- Default:
'' - MinValue: 0
Parameter: dnsServers
Custom DNS servers for the appliance VNet, e.g. a hub firewall DNS proxy. Empty uses Azure-provided DNS.
- Required: No
- Type: array
- Default:
[] - MinValue: 0
Parameter: drainCommands
Shell commands that quiesce the payload before its stack stops on a switchover, a scale-in or a shutdown. They run in the compose directory as root, after the host has left the load balancer pool, and are given up to five minutes. For example flushing a queue, or waiting until no operation is running.
- Required: No
- Type: array
- Default:
[] - MinValue: 0
Parameter: enableBackup
Back up the VMs with Azure Backup (a Recovery Services vault and a daily policy). Default true, and it should stay true for anything that keeps state. Turn it off only for throwaway deployments such as tests: the vault keeps deleted backup items in soft delete for 14 days and soft delete cannot be switched off on it, so removing a deployment whose VMs were backed up can leave the resource group undeletable for that long. loadBalanced has no VM backup either way.
- Required: No
- Type: bool
- Default:
True - MinValue: 0
Parameter: enableKeyVaultPurgeProtection
Purge protection on the Key Vault. Default true, which is the WAF recommendation and what production should use. Turn it off only for throwaway deployments (tests): a purge-protected vault cannot be purged after it is deleted, so its name stays reserved for the retention period.
- Required: No
- Type: bool
- Default:
True - MinValue: 0
Parameter: enablePatchSchedule
Attach the VM to the patch window above. False leaves patching to Azure, at times Azure chooses.
- Required: No
- Type: bool
- Default:
True - MinValue: 0
Parameter: enableTelemetry
Enable/Disable usage telemetry for module.
- Required: No
- Type: bool
- Default:
True - MinValue: 0
Parameter: envFiles
Env files to materialise on the host from the secrets above, before the
compose stack starts. Each entry names a file (written under composeDirectoryName) and a list of
VAR_NAME= az CLI on the box, umask 177 before any file is created, each file chmod 600 immediately after. Required parameters File name, written under composeDirectoryName. Must start with Variables to write into this file. Required parameters Name of the Key Vault secret (must be present in keyVaultSecrets) whose value is written as this variable. Environment variable name written into the file. Resource ID of an existing subnet to place the appliance in, instead of creating a VNet, NSG, NAT Gateway and route table. The subnet must be dedicated and empty: the deployment fails with “appliance requires a dedicated empty subnet” when anything other than this appliance’s own hosts and load balancer sits in it. The module changes nothing about that subnet, so it is the caller’s to provide: egress to the Docker and Ubuntu repositories and the container registry during provisioning, the Microsoft.KeyVault service endpoint (and Microsoft.Storage for activeStandby), and an NSG that allows the inbound ports and, for the load-balanced modes, the AzureLoadBalancer probe. inboundRules, inboundAllowedCidr, createNatGateway, defaultRouteNextHopIpAddress, dnsServers and virtualNetworkPeerings then have no effect. Static private IP address for the first appliance VM (single and activeStandby), inside the appliance subnet. Empty uses cidrHost(the appliance subnet, 4), the first usable address, for a subnet this module creates, and a dynamic address in a subnet the caller brings. The second activeStandby host takes the next address. Not used by loadBalanced, whose hosts are dynamic: callers use applianceAddress. Number of hosts. single: 1. activeStandby: 2. loadBalanced: 1 or more. Every host takes an address in the appliance subnet, so a large loadBalanced count needs a bigger subnet: lower applianceSubnetNewBits (a /27 holds about 26 hosts). ITSM webhook URI for the action group. Name of this module’s Key Vault. Empty (the default) derives a deterministic name from Secrets to store in this module’s own Key Vault. Generic name/value/contentType triples — this module does not know or care what any of them are for. Required parameters Optional parameters Secret name in Key Vault. Secret value. Content type / description shown on the secret. Location for all Resources. A lock to apply to the whole resource group. NOT recommended: a CanNotDelete lock on the group stops Azure Resource Manager grooming deployment history and eventually fails every deployment into it. Leave unset and use protectStatefulResources instead. Optional parameters The lock kind. Name of the lock. Notes about this lock. Monthly in-guest patch window for the VM (Azure Update Manager). Installs Linux Critical and Security updates and reboots only if required. Null (the default) uses Friday after the third Tuesday of the month (ten days after Patch Tuesday). It is a dedicated schedule on purpose: check that any estate-wide schedule you might attach the VM to actually includes the Linux Critical and Security classifications — some include only “Other”, so a Linux VM attached to them is never security-patched. Used only when enablePatchSchedule is true. TCP port the internal load balancer probes and forwards. Required for activeStandby and loadBalanced; the passive activeStandby host never listens on it, which is what keeps it out of service. Extra shell commands run after Extra shell commands run before the compose file is written (e.g. installing an extra apt package one specific payload needs). Empty by default — most payloads need nothing here; treat a long list here as a signal the module’s interface is missing a first-class parameter. Put a CanNotDelete lock on each resource that holds state: the VM, its OS and data disks, the Key Vault, the Recovery Services vault and the Log Analytics workspace this module creates. Resource-level on purpose. A CanNotDelete lock on the resource GROUP also stops Azure Resource Manager deleting the group’s old deployment records, so the group walks to the 800-deployment ceiling and every deployment into it fails. Locks on the resources protect the same data without blocking that. Additional role assignments to grant on this resource group, beyond the identity grants this module manages itself via createNewManagedIdentity. Required parameters Optional parameters The principal ID of the user, group, or service principal to assign the role to. The role to assign — either a full role definition resource ID, or a bare role definition GUID (resolved against this subscription). The principal type of the assigned principal ID. How many hosts there are and what happens when one fails. The mode decides the update and failover rule, not just the host count.[]Parameter Type Description fileNamestring File name, written under composeDirectoryName. Must start with .env: the bootstrap hashes .env* to detect a rotated secret.variablesarray Variables to write into this file. Parameter:
envFiles.fileName.env: the bootstrap hashes .env* to detect a rotated secret.Parameter:
envFiles.variablesParameter Type Description secretNamestring Name of the Key Vault secret (must be present in keyVaultSecrets) whose value is written as this variable. variableNamestring Environment variable name written into the file. Parameter:
envFiles.variables.secretNameParameter:
envFiles.variables.variableNameParameter:
existingSubnetResourceId''Parameter:
hostPrivateIpAddress''Parameter:
instanceCount1Parameter:
itsmWebhookUri''Parameter:
keyVaultNamename and the resource group. Set it when the derived name is taken, for example by a vault that was deleted with purge protection on and so cannot be purged: a purge-protected vault keeps its name for the whole retention period (90 days).''Parameter:
keyVaultSecrets[]Parameter Type Description namestring Secret name in Key Vault. valuesecurestring Secret value. Parameter Type Description contentTypestring Content type / description shown on the secret. Parameter:
keyVaultSecrets.nameParameter:
keyVaultSecrets.valueParameter:
keyVaultSecrets.contentTypeParameter:
location[resourceGroup().location]Parameter:
lockParameter Type Description kindstring The lock kind. namestring Name of the lock. notesstring Notes about this lock. Parameter:
lock.kind[
'CanNotDelete'
'None'
'ReadOnly'
]Parameter:
lock.nameParameter:
lock.notesParameter:
maintenanceWindow1Month Third Tuesday Offset3, 22:00 FLE: theParameter:
payloadPort0Parameter:
postComposeCommandsdocker compose up -d (e.g. a one-off payload-specific bootstrap action). Empty by default.[]Parameter:
preComposeCommands[]Parameter:
protectStatefulResourcesTrueParameter:
roleAssignmentsParameter Type Description principalIdstring The principal ID of the user, group, or service principal to assign the role to. roleDefinitionIdOrNamestring The role to assign — either a full role definition resource ID, or a bare role definition GUID (resolved against this subscription). Parameter Type Description principalTypestring The principal type of the assigned principal ID. Parameter:
roleAssignments.principalIdParameter:
roleAssignments.roleDefinitionIdOrNameParameter:
roleAssignments.principalType[
'Device'
'ForeignGroup'
'Group'
'ServicePrincipal'
'User'
]Parameter:
scaleModesingle (default): one VM. State lives on its data disk; restore from backup. No load balancer. applianceAddress is the VM.activeStandby: two VMs in one zone, ONE data disk attached to the active host, a blob lease so only the host holding it runs the stack, and an internal load balancer whose probe on payloadPort keeps the passive host (stack stopped) out of service. Switchover is a control-plane operation: stop and release on the active host, detach and attach the disk, and the standby takes over. See ADR 0009 and ADR 0011.loadBalanced: a Flexible-orchestration scale set of instanceCount stateless hosts behind an internal load balancer. No data disk and no VM backup. Hosts are patched by Azure’s automatic guest patching (Critical and Security, in batches, availability first) on the platform’s schedule, so enablePatchSchedule and maintenanceWindow do not apply.
- Required: No
- Type: string
- Default:
'single' - Allowed:
[ 'activeStandby' 'loadBalanced' 'single' ] - MinValue: 0
- MaxValue: 65535
Parameter: scaleSetZones
loadBalanced only: availability zones the scale set spreads across, for example [1, 2, 3]. Empty uses availabilityZone alone. A subscription can be barred from a size in some zones, so spread is opt-in.
- Required: No
- Type: array
- Default:
[] - MinValue: 0
- MaxValue: 65535
Parameter: tags
Tags applied to every resource this module creates.
- Required: No
- Type: object
- MinValue: 0
- MaxValue: 65535
Parameter: virtualNetworkPeerings
VNet peerings, in the AVM virtual-network peerings shape. Empty (the
default) peers nothing. A peering with remotePeeringEnabled also writes the remote side, which is
a write OUTSIDE this resource group — the one deliberate exception to this module owning only its
own group, and opt-in for exactly that reason. It needs peer rights on the remote VNet, and a
Managed Application deployment cannot use it.
- Required: No
- Type: array
- Default:
[] - MinValue: 0
- MaxValue: 65535
Parameter: workspaceResourceId
Resource ID of an existing Log Analytics Workspace. If not provided, a new one is created in this resource group — self-contained.
- Required: No
- Type: string
- Default:
'' - MinValue: 0
- MaxValue: 65535
Outputs
| Output | Type | Description |
|---|---|---|
actionGroupResourceId | string | Resource ID of the appliance action group — a workload module adds its own alerts to it. |
applianceAddress | string | The address callers route to: the VM itself for single, the internal load balancer frontend for activeStandby and loadBalanced. |
applianceHostNames | array | Names of the appliance VMs, in host order. Empty for loadBalanced. |
applianceHostResourceIds | array | Resource IDs of the appliance VMs: one for single, two for activeStandby (in host order), empty for loadBalanced. |
applianceSubnetResourceId | string | Resource ID of the appliance subnet — pass this to a workload module that needs to scope its own resources’ network ACLs to the same subnet. |
applianceVmPrivateIpAddress | string | Deprecated alias for applianceAddress, kept so existing consumers compile. Use applianceAddress. |
applianceVmResourceId | string | Resource ID of the first appliance VM, or of the scale set in loadBalanced mode. |
dataDiskName | string | Name of the data disk. Empty when there is none. |
keyVaultName | string | Name of this module’s Key Vault. |
keyVaultUri | string | URI of this module’s Key Vault — pass this to a workload module that needs to reference the same vault. |
leaseStorageAccountName | string | Name of the storage account that holds the active/standby lease. Empty unless activeStandby. |
loadBalancerResourceId | string | Resource ID of the internal load balancer. Empty for single. |
manualStepsRequiredForReuse | array | Empty when createNewManagedIdentity is true (the grant is applied automatically). When reusing an existing identity, this is the one manual role assignment this module itself still needs before the appliance can operate. A workload module appends its own manual steps (if any) to this list. |
resourceGroupName | string | The name of the resource group the appliance was deployed into. |
scaleSetResourceId | string | Resource ID of the scale set. Empty unless loadBalanced. |
virtualNetworkResourceId | string | Resource ID of the VNet this module created. Empty when existingSubnetResourceId is set. |
vmIdentityPrincipalId | string | Principal ID of the VM’s managed identity (new or reused) — a workload module grants this principal whatever additional roles its own resources need. |
vmIdentityResourceId | string | Resource ID of the VM’s managed identity (new or reused). |
workspaceResourceId | string | Resource ID of the Log Analytics Workspace in use (new or provided) — a workload module can add its own data collection or alerts against the same workspace. |
Cross-referenced modules
This section gives you an overview of all local-referenced module files (i.e., other modules that are referenced in this module) and all remote-referenced files (i.e., Bicep modules that are referenced from a Bicep Registry or Template Specs).
| Reference | Type |
|---|---|
br/public:avm/res/compute/virtual-machine:0.15.0 | Remote reference |
br/public:avm/res/insights/action-group:0.7.0 | Remote reference |
br/public:avm/res/insights/data-collection-rule:0.6.1 | Remote reference |
br/public:avm/res/insights/metric-alert:0.4.0 | Remote reference |
br/public:avm/res/insights/scheduled-query-rule:0.5.1 | Remote reference |
br/public:avm/res/key-vault/vault:0.14.0 | Remote reference |
br/public:avm/res/managed-identity/user-assigned-identity:0.4.1 | Remote reference |
br/public:avm/res/network/nat-gateway:1.1.0 | Remote reference |
br/public:avm/res/network/network-security-group:0.5.1 | Remote reference |
br/public:avm/res/network/public-ip-address:0.6.0 | Remote reference |
br/public:avm/res/network/virtual-network:0.7.0 | Remote reference |
br/public:avm/res/operational-insights/workspace:0.12.0 | Remote reference |
br/public:avm/res/recovery-services/vault:0.7.0 | Remote reference |
br/public:avm/res/storage/storage-account:0.33.1 | Remote reference |
Notes
What this module is, and is not
Ubuntu hosts running Docker, each started with ONE Docker Compose stack that the caller supplies, plus everything every such appliance needs around it: network, runtime secret store, backup, monitoring, alerting and patching. How many hosts there are, and what happens when one fails, is the scaleMode (see “Scale modes” below). The default, single, is one VM: availability is a restore-time strategy (backup, redeploy), not redundancy, and the way to scale it is vertically through vmSize.
It is the infrastructure layer of a two-module pattern. A workload module consumes it, supplies the payload and adds whatever only that payload needs. The rule for what goes where:
- Anything every payload needs lives here: VNet and subnet, NSG, NAT Gateway, VM and disks, identity, the Key Vault the VM reads its secrets from, backup, Log Analytics, generic alerts, the patch window.
- Anything only one payload needs lives in that payload’s module: its storage, its application alerts and probes, its compose file, its configuration, its network publishing.
The module is scoped to a resource group (targetScope = 'resourceGroup'), so the caller creates the group and a workload module can place its own resources in the same one.
The payload contract
The module accepts an already-rendered payload and never parses it:
| Parameter | What the caller supplies |
|---|---|
composeFileContent | The full text of docker-compose.yml. Written to /opt/<name>/<composeDirectoryName>/docker-compose.yml on every run, in one decode, so a redeploy replaces it whole. |
keyVaultSecrets | Name, value and content type of each secret to store in this module’s Key Vault. |
envFiles | Env files to build on the host before the stack starts. Each names a file and a list of VARIABLE to Key Vault secret name pairs. The VM reads each secret with its managed identity; no az CLI is installed, files are created with umask 177 and chmod 600. |
inboundRules | One NSG allow rule per published port. A deny-all-else rule is always added beneath them. |
preComposeCommands, postComposeCommands | Extra shell lines before the compose file is written, or after docker compose up -d. A long list here means the interface is missing a first-class parameter. |
additionalSyslogFacilities | Syslog facilities, such as local0, collected at every level so a payload’s own health records reach Log Analytics. |
Compose recreates a container only when its definition changes, never when the content of an env_file changes. The bootstrap therefore hashes the env files before and after rewriting them and runs docker compose up -d --force-recreate when they differ, so a rotated secret takes effect.
Rotating a secret takes a redeploy. The Custom Script extension only runs again when its settings change, and no secret value is in the script, so the script carries a hash of keyVaultSecrets (not the secrets): a changed secret changes the script, the next deployment rewrites the env files and the containers are recreated. Env file names must start with .env, and secret values must be single-line (a newline breaks the file, and a $ in a value has not been tested against Compose interpolation).
The bootstrap fails loudly where it can. It stops with a non-zero exit, which fails the VM deployment, when Docker is not installed, when a Key Vault secret named in envFiles cannot be read, or when docker compose up fails. It does not use set -e, so a failure in a preComposeCommands or postComposeCommands line does not stop it unless that line exits explicitly. For a reused identity (createNewManagedIdentity = false), grant Key Vault Secrets User on the vault before the first deployment: a deployment that cannot read its secrets now fails instead of starting containers with empty credentials.
The bootstrap script runs as a Custom Script extension during VM provisioning. It needs outbound access to download.docker.com, the Ubuntu archive and whatever registries the compose file pulls from, so the appliance must have egress when the VM is created.
Scale modes
scaleMode | Hosts | State | Failover |
|---|---|---|---|
single (default) | One VM. instanceCount is 1. | One data disk. | Restore from backup. No load balancer; applianceAddress is the VM. |
activeStandby | Two VMs in one zone. instanceCount is 2. | One data disk, attached to the active host (activeInstance) only. | A blob lease keeps a single writer. An internal Standard load balancer probes TCP payloadPort, so the passive host, whose stack is stopped, receives nothing. Switchover is a control-plane operation, see below. |
loadBalanced | A Flexible scale set of instanceCount hosts, spread over scaleSetZones. | None. No data disk, no VM backup. | The internal load balancer drops a host that fails the probe. Scale-in drains the stack first. |
Patching in loadBalanced. Hosts are patched automatically by Azure (Critical and Security, in availability-first batches, gated on the Application Health check of payloadPort) at all hours, with no patch window, by design; enablePatchSchedule and maintenanceWindow apply to the VM modes only.
Both load-balanced modes need payloadPort. Callers route to the applianceAddress output, never to a host. Hosts are named <name>-host01, <name>-host02, … (the applianceHostNames output).
Switchover (activeStandby). The agent on each host only takes the lease, mounts the data disk, starts the stack, drains and releases. Moving the disk is an Azure Resource Manager operation that the control plane runs with its own identity, so no host has any right over its sibling:
- On the active host:
sudo /usr/local/sbin/appliance-agent.sh release. This drains the stack (drainCommands), stops it, unmounts the data disk and releases the lease, and keeps the host passive. - Detach the data disk (
dataDiskNameoutput) from the active host. - Attach it to the standby at LUN 0.
The standby’s agent sees the disk, takes the lease, mounts it and starts the stack, and the load balancer probe then admits it. If the active host cannot answer, skip step 1, wait out the 60-second lease and force-detach. After a switchover redeploy with activeInstance set to the host that now holds the disk, or the template attaches the disk to the other host. The e2e test active-standby proves both paths: the planned switchover above, and a failover from a dead host (the active VM is deallocated, so nothing releases the lease; the disk is force-detached and attached to the other host, which takes the lease once it has expired and serves). A standby that cannot take the lease, because the dead host still holds it, simply stays passive and retries every few seconds until the lease expires; that case is not tested. Both hosts are in one availability zone, because a managed disk is zonal, so a zone outage takes down both. See ADR 11.
Testing note. A failed removal of a resource group that holds a Recovery Services vault with backup items can block that group, and so its name, for 14 days: the vault keeps the items in soft delete, which cannot be disabled on a vault created with enhanced security. A test that has to be re-run after such a failure takes a new serviceShort.
Container registry authentication
containerRegistry.mode is anonymous (default), managedIdentity (the VM identity, with AcrPull granted when registryResourceId is set) or keyVaultToken (a token from keyVaultSecrets, named by tokenSecretName). Never use a personal access token. Images mirrored into ghcr.io/innofactororg/mirror/* are private, and keyVaultToken with a read-only token in the appliance Key Vault is the supported way to pull them. The private-registry e2e test proves keyVaultToken against a private ghcr.io image. managedIdentity is unproven: it needs an Azure Container Registry, and no test has one. In both modes the agent is logged in only while it pulls, so no token stays on disk. See ADR 10.
Bring your own subnet
existingSubnetResourceId places the appliance in an existing subnet instead of creating a VNet, NSG, NAT Gateway and route table. The module changes nothing about that subnet, so the caller provides egress to the Docker and Ubuntu repositories and the registry, the Microsoft.KeyVault service endpoint (and Microsoft.Storage for activeStandby), and an NSG that allows the inbound ports and, for the load-balanced modes, the AzureLoadBalancer probe. inboundRules, inboundAllowedCidr, createNatGateway, defaultRouteNextHopIpAddress, dnsServers and virtualNetworkPeerings have no effect then.
The subnet must be dedicated and empty. Anything in it other than this appliance’s own hosts and load balancer (resources named <name>-...) fails the deployment with:
The provided value for the template parameter 'applianceRequiresADedicatedEmptySubnet' is not valid. The value 'false' is not part of the allowed value(s): 'True'.The other cross-parameter rules fail the same way, named for the rule: instanceCountMatchesScaleMode, activeStandbyNeedsADataDisk, loadBalancedModesNeedAPayloadPort and containerRegistrySettingsAreComplete.
Upgrading from the single-VM interface
Every parameter name is kept and single is the default, so a caller that sets nothing new gets one VM as before. What a consumer of the earlier single-VM interface will notice:
- The agent starts the stack, not the Custom Script extension. The extension installs Docker, writes the files and starts the
appliance-agentsystemd unit, which runsdocker compose up -d. The extension succeeds only when the agent reportsactive(orstandby), so a compose file or image that cannot start still fails the deployment.postComposeCommandsnow run after the agent has settled. - The data disk is no longer in
/etc/fstab. The agent mounts it by LUN at/opt/<name>/<dataDirectoryName>before it starts the stack, and formats it only when it has no file system at all. A host that only reboots remounts it through the agent. - The data disk name changed. It is
<name>-data-disk(was<name>-host01-data-disk) because it no longer belongs to one host. The VM and OS disk names are unchanged (<name>-host01,<name>-host01-osdisk). vnetAddressPrefixis optional andhostPrivateIpAddressdefaults to an empty string (resolved to the same first usable address). Both only matter when the module creates the VNet.- Containers log to the journal (
journalddriver, tagged with the container name) instead of the default JSON files, and the data collection rule collects them (syslog facilityuser). - Outputs.
applianceAddressis new.applianceVmPrivateIpAddressis now an alias of it.applianceVmResourceIdis the scale set inloadBalancedmode. - A secret or compose change recreates the stack: the bootstrap compares a hash of the compose file and env files, and the agent runs
docker compose up -d --force-recreatewhen it changed.
Prerequisites
None of these are created by the module.
- A resource group to deploy into, and an address range for
vnetAddressPrefixregistered in whatever IPAM the estate uses, so it cannot collide with another spoke. The module creates and owns its VNet unlessexistingSubnetResourceIdis set. - Egress at provisioning time. With the default NAT Gateway (
createNatGateway = true) nothing more is needed. If egress goes through a hub firewall instead (createNatGateway = falseplusdefaultRouteNextHopIpAddress), that firewall must already allow the bootstrap’s endpoints, and a missing entry shows as a deny in the firewall log, not as a module error. A NAT Gateway created but left unassociated bills and looks like egress is handled when it is not. If the VNet is later peered to a hub that advertises0.0.0.0/0, that route overrides the NAT Gateway and redirects egress through the hub. - Rights to deploy role assignments in the resource group. The module grants the new identity
Key Vault Secrets Useron its own vault. InloadBalancedmode the deployer also needs policy assignment write (Microsoft.Authorization/policyAssignments/write) at the resource group, for example Resource Policy Contributor, because the module assigns a policy there (see Monitoring). - An alert receiver. Set
alertEmailAddressesand/oritsmWebhookUri. The alerts are always created, but an action group with no receiver delivers nothing. - Quota for the chosen
vmSizein the chosenavailabilityZone. A subscription can be barred from a size in some zones and not others;az vm list-skus -l <region> --resource-type virtualMachinesshowsNotAvailableForSubscriptionper zone.
Locks: resource-level, never on the resource group
Leave lock unset. A CanNotDelete lock on the resource group also stops Azure Resource Manager deleting the group’s old deployment records, so the group walks to the 800-deployment ceiling and every deployment into it then fails. protectStatefulResources (default true) puts a CanNotDelete lock on each resource that holds state instead: the VM, its OS and data disks, the Key Vault, the Recovery Services vault and the Log Analytics workspace when the module creates it. If a policy in the estate stamps resource-group delete locks, add a policy exemption for this resource group and delete the stamped lock.
Identity
createNewManagedIdentity = true (default) creates a user-assigned identity and grants it only what the module itself needs, Key Vault Secrets User on its own vault (scoped to that vault, and complete before the VM starts its bootstrap). What the payload is allowed to do beyond that is the caller’s decision and is granted to vmIdentityPrincipalId. Setting it to false attaches an existing identity (existingIdentityResourceId, existingIdentityPrincipalId) and grants it nothing; the manualStepsRequiredForReuse output lists the one role assignment still needed. Whoever deploys also needs Managed Identity Operator on a reused identity. Attaching an identity from another subscription in the same tenant is believed to work but is unproven.
Data disk
The dedicated data disk (LUN 0, deleteOption: Detach) is formatted on first use and mounted by the agent at /opt/<name>/<dataDirectoryName>, so it survives deleting the VM and is remounted on restart. There is no /etc/fstab entry. Its host caching is None, because ReadWrite host caching can acknowledge a write that is then lost on host failure, and host read caching only applies to Premium disks.
A data-disk property change on a running VM is an outage. Azure applies any change under dataDisks (caching, size, SKU) by hot-detaching and re-attaching the disk. The guest kernel takes the device offline and the ext4 filesystem on it may not survive, while the VM and the container keep running and look healthy. Check the what-if for a change under dataDisks before every deployment, schedule it as an outage, restart the VM straight afterwards and check the mount.
dataDiskSizeGB = 0 creates no data disk. The data directory is then an ordinary directory on the OS disk, which suits a payload that keeps nothing worth restoring.
Patching
The VM is attached to a dedicated Azure Update Manager maintenance configuration (enablePatchSchedule, maintenanceWindow). The default is 1Month Third Tuesday Offset3 at 22:00 FLE: the third Tuesday of the month plus three days, so the Friday after Patch Tuesday week, ten days after Patch Tuesday. It installs Linux Critical and Security updates and reboots only if required. The schedule is dedicated on purpose. Check that any estate-wide schedule you might attach the VM to includes the Linux Critical and Security classifications: some include only “Other”, and a Linux VM attached to those is never security-patched. With enablePatchSchedule = false Azure patches at times it chooses.
Backup
enableBackup (default true) controls it. Keep it on for anything that holds state; the e2e tests turn it off except waf-aligned, because removing a deployment whose VMs were backed up can leave the resource group undeletable for 14 days (see below). loadBalanced has no VM backup and creates no vault.
Daily VM backup (23:00 UTC; 14 daily and 6 weekly recovery points) covers both disks. The vault has soft delete and enhanced security on, and an Unlocked immutable setting, so recovery points cannot be deleted before they expire. The cost is deliberate: the vault cannot be removed until the 14-day soft-delete period has passed, so tearing a deployment down is a two-step job.
Monitoring
Log collection in loadBalanced. A Flexible scale set does not pass a data collection rule association to its VMs, so the module assigns the built-in policy “Configure Linux Virtual Machines to be associated with a Data Collection Rule or a Data Collection Endpoint” (DeployIfNotExists) at the resource group. The assignment has a system-assigned identity, which the module grants Monitoring Contributor and Log Analytics Contributor (the roles the definition declares) at the resource group, and a remediation task covers instances that exist at deployment. Hosts added later by a scale-out or a repair are associated by the policy too. The association is therefore not part of the deployment: in a sandbox it existed about 35 seconds after the VM was created, and the agent then needs a few minutes to start sending, so expect Heartbeat and Syslog within roughly 5 to 10 minutes of a new host appearing. If the policy misses a host, the next compliance scan (up to 24 hours) or a remediation task associates it. The policy covers the regions in its definition. The VM modes associate each VM in the template and need none of this. See ADR 20.
Each host also runs appliance-heartbeat.timer, which writes one syslog line a minute (appliance-heartbeat, facility user, host=<hostname>,mode=<scaleMode>), so every host has a Syslog row once the agent is configured even when the payload is quiet.
A heartbeat alert (fewer hosts reporting than expected), a sustained-CPU metric alert, a container-restart alert, an action group, a data collection rule (performance counters, syslog and container logs) and a small health workbook. The Docker journald log driver tags each line with the container name and the journal forwards it to syslog facility user, so Syslog | where ProcessName == "<container name>" returns a container’s stdout. Because the journald driver leaves no line when a container restarts, the agent logs container-restarted name=... restarts=... and the restart alert counts those (containerRestartAlertThreshold in 15 minutes). There is deliberately no disk-space metric alert: the Azure Monitor Agent reports the disk/free_percent guest metric as a garbage integer, so a threshold on it can never fire. A payload that needs one measures free space itself and alerts on it from Log Analytics, using the workspaceResourceId and actionGroupResourceId outputs.
Network
The module creates one VNet with one subnet (ApplianceSubnet, carved as the first subnet of vnetAddressPrefix with cidrSubnet() at prefix length applianceSubnetNewBits), with Microsoft.KeyVault and Microsoft.Storage service endpoints, and an NSG that allows only inboundRules and denies the rest. The Key Vault accepts traffic only from that subnet, so no operator or pipeline agent can read it directly. virtualNetworkPeerings with remotePeeringEnabled also writes the remote side, which is a write outside this resource group and needs peer rights on the remote VNet. With defaultRouteNextHopIpAddress set, a route table sends 0.0.0.0/0 to that address with gateway route propagation off, so a route learned over a hub’s gateways cannot send this subnet’s traffic around the firewall; set createNatGateway to false alongside it, because a user-defined default route takes precedence over a NAT Gateway.
Data Collection
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
Changelog
Changelog
0.2.1
Changes
- A
loadBalancedoractiveStandbyhost that the platform schedules for removal (a scale-in, a reboot, a redeploy) now leaves the load balancer pool before it drains. The agent rejects the load balancer’s probe with a TCP reset, waits(probeThreshold + 1) x intervalInSeconds + 5seconds (20 with the module’s probe), runsdrainCommands, stops the stack and only then approves the event. Before, the balancer kept sending new connections to a host that had stopped taking them, and clients saw deferred and refused connections for up to 20 seconds on every scale-in (ADR 21, issue #230). - The drain hook now gets what is left of the event’s
NotBefore(at most 300 seconds), not a fixed 300, and the approval and its result are logged.terminateNotificationProfile.notBeforeTimeoutisPT10M(it wasPT5M) so that the drain keeps its full budget after the pool exit. - The agent asks the metadata service for scheduled events with a 10-second timeout, so a stuck request cannot stop it from seeing a
Terminateevent.
Breaking Changes
- None
0.2.0
Changes
- Fixes
loadBalancedlog collection. The data collection rule was associated with the Flexible scale set, which does not pass it to its VMs, so no host sent Heartbeat or Syslog and every log-based alert was dead. The module now assigns the built-in Azure Policy “Configure Linux Virtual Machines to be associated with a Data Collection Rule or a Data Collection Endpoint” (DeployIfNotExists) at the resource group, with its managed identity and the roles the definition declares, and starts a remediation task. Hosts added by a scale-out or replaced by a repair are associated by the policy too (ADR 20, issue 229). - Every host runs a systemd timer,
appliance-heartbeat.timer, that writes one syslog line a minute (logger -t appliance-heartbeat, facilityuser:host=<hostname>,mode=<scaleMode>). The data collection rule collects only warnings from the system facilities, so a quiet payload left a healthy host with no Syslog row. The line is also a liveness signal in Log Analytics. - The bootstrap waits for apt and dpkg locks before each
apt-get update, retries the update, and stops when a step fails.DPkg::Lock::Timeoutdoes not cover the lists lock, so anapt-get updateracing another apt at first boot failed and the Docker install followed with no candidate. - The e2e tests now assert that Heartbeat and Syslog rows from every host reach the workspace. The test probe takes
workspaceResourceId,hostNamePrefixandexpectedHostCount.
Breaking Changes
loadBalancedonly: the identity that deploys the module (the pipeline service principal or the person running the deployment) must now be granted both of these at the appliance resource group, or at a scope above it:Microsoft.Authorization/policyAssignments/write, for example the built-in role Resource Policy Contributor.Microsoft.Authorization/roleAssignments/write, for example User Access Administrator or Role Based Access Control Administrator. The module already needed this to grant the appliance identity Key Vault access, but it now also grants Monitoring Contributor and Log Analytics Contributor to the policy assignment’s identity, so a role assignment condition that limits the deployer to other roles blocks it.- Owner at the resource group covers both. The VM modes (
single,activeStandby) need no new permission.
- A new
loadBalancedhost is associated with the data collection rule by policy shortly after it is created, not as part of the deployment.
0.1.1
Changes
loadBalancedhosts are now repaired automatically. The scale set turns onautomaticRepairsPolicy, driven by the existing Application Health probe, withautomaticRepairGracePeriod(defaultPT30M) andautomaticRepairAction(defaultRestart).Restartkeeps the OS disk, so a payload that keeps a queue there (the SMTP relay) does not lose it;ReplaceandReimagedo (ADR 19).- The Application Health probe now needs three failed checks in a row (was one) before a host counts as unhealthy, so one dropped connection cannot trigger a repair or hold back a patch.
- Clears the PSRule WAF Reliability rule
Azure.VMSS.AutoInstanceRepairs.
Breaking Changes
- None
0.1.0
Changes
- First release of the module. A payload-agnostic landing-zone pattern for a managed container appliance: its own VNet, subnet, NSG and NAT Gateway (or a subnet you bring), VM and disks, managed identity, Key Vault, backup, monitoring, alerting and patching. See the README for parameters and examples.
- Three scale modes,
single(the default),activeStandbyandloadBalanced, selected withscaleMode(ADR 9). Both load-balanced modes publish one address,applianceAddress. activeStandbykeeps one data disk that follows the active host, guarded by a blob lease. Switchover is a control-plane operation, so the hosts hold no rights over each other (ADR 11).containerRegistryauthenticates to the image registry anonymously, with the VM identity, or with a Key Vault token. Personal access tokens are not accepted (ADR 10).- Container logs go to the journal through Docker’s
journalddriver and are collected into Log Analytics. A generic container-restart alert is included. existingSubnetResourceIdplaces the appliance in an empty subnet you provide. The deployment fails with “appliance requires a dedicated empty subnet” when the subnet holds anything else.- The
loadBalancedhosts are patched by Azure’s automatic guest patching, with an Application Health extension. They have no custom patch window. enableBackup(default true) turns VM backup, and the Recovery Services vault, off for throwaway deployments.loadBalancednever backs up VMs.- Host names are no longer fixed: alerts, the workbook and disk names follow the hosts of the chosen mode.
- Tests: defaults, no-data-disk, waf-aligned, active-standby (with a timed switchover), load-balanced and byo-subnet. Each deploys a web payload and curls the appliance address from a client VM.
Breaking Changes
- None
Version history
| Version | Published |
|---|---|
0.2.1 | 2026-11-24 |
0.2.0 | 2026-11-23 |
0.1.1 | 2026-11-14 |
0.1.0 | 2026-11-14 |