SMTP Relay Landing Zone

br/innofactor:avm/ptn/lz/smtp-relay:0.2.0

README

SMTP Relay (Landing Zone Pattern) [Lz/SmtpRelay]

A managed SMTP relay: Postfix on N hosts behind an internal load balancer, delivering mail through Microsoft Graph, with its own network, Key Vault, monitoring and payload alerts. Subscription-scope wrapper: it creates ONE resource group, then invokes smtp-relay.bicep, which renders the compose file from parameters and calls the container-appliance pattern module (avm/ptn/lz/container-appliance) in loadBalanced mode.

All parameters pass straight through. The hub side is a prerequisite this module does not write: a firewall DNAT rule to the load balancer address, and hub return routes for the relay subnet (workload-networking hubReturnRoutes). See the Notes section.

Resource Types

Resource TypeAPI Version
Microsoft.Authorization/locks2020-05-01
Microsoft.Authorization/policyAssignments2024-04-01
Microsoft.Authorization/roleAssignments2022-04-01
Microsoft.Automanage/configurationProfileAssignments2022-05-04
Microsoft.Compute/disks2024-03-02
Microsoft.Compute/virtualMachines2024-07-01
Microsoft.Compute/virtualMachines/extensions2022-11-01
Microsoft.Compute/virtualMachineScaleSets2024-07-01
Microsoft.DevTestLab/schedules2018-09-15
Microsoft.GuestConfiguration/guestConfigurationAssignments2020-06-25
Microsoft.Insights/actionGroups2023-01-01
Microsoft.Insights/dataCollectionRuleAssociations2023-03-11
Microsoft.Insights/dataCollectionRules2023-03-11
Microsoft.Insights/diagnosticSettings2021-05-01-preview
Microsoft.Insights/metricAlerts2018-03-01
Microsoft.Insights/scheduledQueryRules2025-01-01-preview
Microsoft.Insights/workbooks2023-06-01
Microsoft.KeyVault/vaults2024-11-01
Microsoft.KeyVault/vaults/accessPolicies2024-11-01
Microsoft.KeyVault/vaults/keys2024-11-01
Microsoft.KeyVault/vaults/secrets2024-11-01
Microsoft.Maintenance/configurationAssignments2023-04-01
Microsoft.Maintenance/maintenanceConfigurations2023-04-01
Microsoft.ManagedIdentity/userAssignedIdentities2024-11-30
Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials2024-11-30
Microsoft.Network/loadBalancers2024-05-01
Microsoft.Network/natGateways2023-04-01
Microsoft.Network/networkInterfaces2024-05-01
Microsoft.Network/networkSecurityGroups2023-11-01
Microsoft.Network/privateEndpoints2024-10-01
Microsoft.Network/privateEndpoints2023-11-01
Microsoft.Network/privateEndpoints2024-05-01
Microsoft.Network/privateEndpoints/privateDnsZoneGroups2024-10-01
Microsoft.Network/privateEndpoints/privateDnsZoneGroups2024-05-01
Microsoft.Network/privateEndpoints/privateDnsZoneGroups2023-11-01
Microsoft.Network/publicIPAddresses2023-09-01
Microsoft.Network/publicIPAddresses2024-05-01
Microsoft.Network/publicIPPrefixes2023-09-01
Microsoft.Network/routeTables2024-05-01
Microsoft.Network/virtualNetworks2024-05-01
Microsoft.Network/virtualNetworks/subnets2024-05-01
Microsoft.Network/virtualNetworks/virtualNetworkPeerings2024-01-01
Microsoft.OperationalInsights/workspaces2025-02-01
Microsoft.OperationalInsights/workspaces/dataExports2025-02-01
Microsoft.OperationalInsights/workspaces/dataSources2025-02-01
Microsoft.OperationalInsights/workspaces/linkedServices2025-02-01
Microsoft.OperationalInsights/workspaces/linkedStorageAccounts2025-02-01
Microsoft.OperationalInsights/workspaces/savedSearches2025-02-01
Microsoft.OperationalInsights/workspaces/storageInsightConfigs2025-02-01
Microsoft.OperationalInsights/workspaces/tables2025-02-01
Microsoft.OperationsManagement/solutions2015-11-01-preview
Microsoft.PolicyInsights/remediations2021-10-01
Microsoft.RecoveryServices/vaults2024-04-01
Microsoft.RecoveryServices/vaults/backupconfig2023-01-01
Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems2024-10-01
Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems2023-01-01
Microsoft.RecoveryServices/vaults/backupPolicies2024-10-01
Microsoft.RecoveryServices/vaults/backupstorageconfig2023-01-01
Microsoft.RecoveryServices/vaults/replicationAlertSettings2022-10-01
Microsoft.RecoveryServices/vaults/replicationFabrics2022-10-01
Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers2022-10-01
Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings2022-10-01
Microsoft.RecoveryServices/vaults/replicationPolicies2023-06-01
Microsoft.Resources/resourceGroups2021-04-01
Microsoft.SecurityInsights/onboardingStates2024-03-01
Microsoft.Storage/storageAccounts2025-06-01
Microsoft.Storage/storageAccounts/blobServices2025-01-01
Microsoft.Storage/storageAccounts/blobServices/containers2025-01-01
Microsoft.Storage/storageAccounts/blobServices/containers/immutabilityPolicies2025-01-01
Microsoft.Storage/storageAccounts/fileServices2025-06-01
Microsoft.Storage/storageAccounts/fileServices/shares2025-01-01
Microsoft.Storage/storageAccounts/localUsers2025-06-01
Microsoft.Storage/storageAccounts/managementPolicies2025-06-01
Microsoft.Storage/storageAccounts/objectReplicationPolicies2025-01-01
Microsoft.Storage/storageAccounts/queueServices2025-06-01
Microsoft.Storage/storageAccounts/queueServices/queues2025-06-01
Microsoft.Storage/storageAccounts/tableServices2025-06-01
Microsoft.Storage/storageAccounts/tableServices/tables2025-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/smtp-relay:<version>.

Example 1: Using only defaults

This instance deploys the SMTP relay with its own VNet and a single host behind the internal load balancer, pulling the relay image by digest with a read-only registry token. A client VM in the relay subnet proves, through the load balancer address, that the relay accepts mail from an allowed sender and refuses a sender that is not on the list, then sends a real message to a sandbox mailbox and proves from the relay log and through Graph that it arrived. The sandbox Graph app and mailbox come from the CI Key Vault (CI-graphTenantId, CI-graphClientId, CI-graphClientSecret, CI-graphTestMailbox); the deployment fails at validation, naming the parameter, while one is missing.

via Bicep module
module smtpRelay 'br/innofactor:avm/ptn/lz/smtp-relay:<version>' = {
  name: 'smtpRelayDeployment'
  params: {
    // Required parameters
    graphClientId: '<graphClientId>'
    graphClientSecret: '<graphClientSecret>'
    graphSenderMailbox: '<graphSenderMailbox>'
    graphTenantId: '<graphTenantId>'
    inboundAllowedCidr: '10.0.0.0/8'
    mailDomain: 'example.test'
    myNetworks: [
      '10.242.0.0/24'
    ]
    relayHostname: 'relay.example.test'
    senderAllowList: [
      'probe@example.test'
    ]
    sshPublicKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
    // Non-required parameters
    enableKeyVaultPurgeProtection: false
    instanceCount: 1
    keyVaultName: '<keyVaultName>'
    location: '<location>'
    name: '<name>'
    registryToken: '<registryToken>'
    scaleSetZones: [
      1
      2
    ]
    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
    "graphClientId": {
      "value": "<graphClientId>"
    },
    "graphClientSecret": {
      "value": "<graphClientSecret>"
    },
    "graphSenderMailbox": {
      "value": "<graphSenderMailbox>"
    },
    "graphTenantId": {
      "value": "<graphTenantId>"
    },
    "inboundAllowedCidr": {
      "value": "10.0.0.0/8"
    },
    "mailDomain": {
      "value": "example.test"
    },
    "myNetworks": {
      "value": [
        "10.242.0.0/24"
      ]
    },
    "relayHostname": {
      "value": "relay.example.test"
    },
    "senderAllowList": {
      "value": [
        "probe@example.test"
      ]
    },
    "sshPublicKey": {
      "value": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test"
    },
    // Non-required parameters
    "enableKeyVaultPurgeProtection": {
      "value": false
    },
    "instanceCount": {
      "value": 1
    },
    "keyVaultName": {
      "value": "<keyVaultName>"
    },
    "location": {
      "value": "<location>"
    },
    "name": {
      "value": "<name>"
    },
    "registryToken": {
      "value": "<registryToken>"
    },
    "scaleSetZones": {
      "value": [
        1,
        2
      ]
    },
    "vnetAddressPrefix": {
      "value": "10.242.0.0/24"
    }
  }
}

via Bicep parameters file
using 'br/innofactor:avm/ptn/lz/smtp-relay:<version>'

// Required parameters
param graphClientId = '<graphClientId>'
param graphClientSecret = '<graphClientSecret>'
param graphSenderMailbox = '<graphSenderMailbox>'
param graphTenantId = '<graphTenantId>'
param inboundAllowedCidr = '10.0.0.0/8'
param mailDomain = 'example.test'
param myNetworks = [
  '10.242.0.0/24'
]
param relayHostname = 'relay.example.test'
param senderAllowList = [
  'probe@example.test'
]
param sshPublicKey = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
// Non-required parameters
param enableKeyVaultPurgeProtection = false
param instanceCount = 1
param keyVaultName = '<keyVaultName>'
param location = '<location>'
param name = '<name>'
param registryToken = '<registryToken>'
param scaleSetZones = [
  1
  2
]
param vnetAddressPrefix = '10.242.0.0/24'

Example 2: WAF-aligned

This instance deploys the SMTP relay in alignment with the best practices of the Azure Well-Architected Framework: two hosts spread behind the internal load balancer, placed in an empty subnet the caller brings (here in a VNet the test creates, with a client subnet beside it), CanNotDelete locks on the stateful resources and deliberately NO resource-group lock, a purge-protected Key Vault, and an alert email receiver. The client sits on a network that is NOT in myNetworks, and the test proves the relay still answers EHLO but refuses to relay for it. Real Graph delivery is proven by the defaults test.

via Bicep module
module smtpRelay 'br/innofactor:avm/ptn/lz/smtp-relay:<version>' = {
  name: 'smtpRelayDeployment'
  params: {
    // Required parameters
    graphClientId: '00000000-0000-0000-0000-000000000000'
    graphClientSecret: '<graphClientSecret>'
    graphSenderMailbox: 'relay@example.test'
    graphTenantId: '00000000-0000-0000-0000-000000000000'
    inboundAllowedCidr: '10.0.0.0/8'
    mailDomain: 'example.test'
    myNetworks: [
      '192.0.2.0/24'
    ]
    relayHostname: 'relay.example.test'
    senderAllowList: [
      'probe@example.test'
    ]
    sshPublicKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
    // Non-required parameters
    alertEmailAddresses: [
      'platform-alerts@example.com'
    ]
    availabilityZone: 1
    existingSubnetResourceId: '<existingSubnetResourceId>'
    instanceCount: 2
    keyVaultName: '<keyVaultName>'
    location: '<location>'
    name: '<name>'
    protectStatefulResources: true
    registryToken: '<registryToken>'
    scaleSetZones: [
      1
      2
    ]
    tags: {
      Environment: 'Test'
      Workload: 'smtp-relay'
    }
  }
}

via JSON parameters file
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    // Required parameters
    "graphClientId": {
      "value": "00000000-0000-0000-0000-000000000000"
    },
    "graphClientSecret": {
      "value": "<graphClientSecret>"
    },
    "graphSenderMailbox": {
      "value": "relay@example.test"
    },
    "graphTenantId": {
      "value": "00000000-0000-0000-0000-000000000000"
    },
    "inboundAllowedCidr": {
      "value": "10.0.0.0/8"
    },
    "mailDomain": {
      "value": "example.test"
    },
    "myNetworks": {
      "value": [
        "192.0.2.0/24"
      ]
    },
    "relayHostname": {
      "value": "relay.example.test"
    },
    "senderAllowList": {
      "value": [
        "probe@example.test"
      ]
    },
    "sshPublicKey": {
      "value": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test"
    },
    // Non-required parameters
    "alertEmailAddresses": {
      "value": [
        "platform-alerts@example.com"
      ]
    },
    "availabilityZone": {
      "value": 1
    },
    "existingSubnetResourceId": {
      "value": "<existingSubnetResourceId>"
    },
    "instanceCount": {
      "value": 2
    },
    "keyVaultName": {
      "value": "<keyVaultName>"
    },
    "location": {
      "value": "<location>"
    },
    "name": {
      "value": "<name>"
    },
    "protectStatefulResources": {
      "value": true
    },
    "registryToken": {
      "value": "<registryToken>"
    },
    "scaleSetZones": {
      "value": [
        1,
        2
      ]
    },
    "tags": {
      "value": {
        "Environment": "Test",
        "Workload": "smtp-relay"
      }
    }
  }
}

via Bicep parameters file
using 'br/innofactor:avm/ptn/lz/smtp-relay:<version>'

// Required parameters
param graphClientId = '00000000-0000-0000-0000-000000000000'
param graphClientSecret = '<graphClientSecret>'
param graphSenderMailbox = 'relay@example.test'
param graphTenantId = '00000000-0000-0000-0000-000000000000'
param inboundAllowedCidr = '10.0.0.0/8'
param mailDomain = 'example.test'
param myNetworks = [
  '192.0.2.0/24'
]
param relayHostname = 'relay.example.test'
param senderAllowList = [
  'probe@example.test'
]
param sshPublicKey = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM9TTqqoeYf+/iC1UenThlG3LrKakoeCeDQS3veHJqXe avs-e2e-test'
// Non-required parameters
param alertEmailAddresses = [
  'platform-alerts@example.com'
]
param availabilityZone = 1
param existingSubnetResourceId = '<existingSubnetResourceId>'
param instanceCount = 2
param keyVaultName = '<keyVaultName>'
param location = '<location>'
param name = '<name>'
param protectStatefulResources = true
param registryToken = '<registryToken>'
param scaleSetZones = [
  1
  2
]
param tags = {
  Environment: 'Test'
  Workload: 'smtp-relay'
}

Parameters

Required parameters

ParameterTypeDescription
graphClientIdstringClient (application) ID of the Entra app registration: single tenant, no public client flows, and the Mail.Send application permission only, admin-consented. The app registration is a prerequisite: it is a Graph object, not an ARM resource.
graphClientSecretsecurestringClient secret of that app registration. Stored in the appliance Key Vault and written to an env file on the host at boot. Never part of the compose file.
graphSenderMailboxstringThe mailbox Graph sends as. Every message is sent from this mailbox, whatever the original sender. It must be a real Exchange Online mailbox, shared (no licence needed) or licensed: a user whose licence was removed has no mailbox. Restrict the Entra app to it with an application access policy (see the README prerequisites).
graphTenantIdstringEntra tenant ID of the app registration that sends the mail.
inboundAllowedCidrstringCIDR allowed inbound to the relay on port 25: the subnet the hub firewall forwards from. This module opens nothing else.
mailDomainstringThe mail domain: Postfix mydomain and myorigin, for example contoso.com.
myNetworksarrayNetworks allowed to relay, as CIDRs. Used verbatim as Postfix mynetworks: nothing is added, so list loopback yourself if you need it. At least one entry.
relayHostnamestringThe name the relay announces: Postfix myhostname and the SMTP banner, for example smtp.contoso.com.
senderAllowListarraySender addresses (or domain names, which match every address in them) allowed to send through the relay. The Graph mailbox is always allowed. Enforced for every client, trusted networks included. At least one entry.
sshPublicKeystringSSH public key for the admin account. Password sign-in is disabled.

Conditional parameters

ParameterTypeDescription
existingIdentityPrincipalIdstringRequired if createNewManagedIdentity is false. Principal ID of the existing identity.
existingIdentityResourceIdstringRequired if createNewManagedIdentity is false. Resource ID of the existing identity.
registryTokensecurestringRequired if containerRegistry.mode is keyVaultToken. A read-only registry token (read:packages) issued to a service identity, never to a person. Stored in the appliance Key Vault as the secret named by containerRegistry.tokenSecretName.
vnetAddressPrefixstringRequired if existingSubnetResourceId is empty. Address space for the relay’s own VNet, for example 10.20.0.0/24.

Optional parameters

ParameterTypeDescription
adminUsernamestringLocal admin username on the hosts.
alertEmailAddressesarrayEmail addresses added to the action group. A service desk mailbox turns each alert into a ticket.
applianceSubnetNewBitsintPrefix length of the appliance subnet, carved as the first subnet of vnetAddressPrefix (27 = a /27, about 26 hosts). Despite the name, this is a prefix length.
availabilityZoneintAvailability zone for the hosts that are not spread by scaleSetZones.
businessHoursEndUtcintBusiness hours end at the start of this hour, UTC, 1 to 24. Weekdays only.
businessHoursStartUtcintFirst business hour, UTC, 0 to 23.
containerRegistryobjectHow the hosts pull the relay image. The default is ghcr.io with a read-only token held in the appliance Key Vault (mode keyVaultToken, secret registry-token). The relay image package is private, so the token is needed. Use anonymous only if the package is public, or managedIdentity for an Azure Container Registry.
containerRestartAlertThresholdintThe container-restart alert fires when the relay container restarts more than this many times in 15 minutes.
createNatGatewayboolCreate and associate a NAT Gateway for outbound egress. Ignored with existingSubnetResourceId.
createNewManagedIdentityboolCreate a new user-assigned identity (true) or attach an existing one (false).
defaultRouteNextHopIpAddressstringNext-hop IP for a 0.0.0.0/0 route on the relay subnet, for example the hub firewall. Ignored with existingSubnetResourceId.
dnsServersarrayCustom DNS servers for the relay VNet. Ignored with existingSubnetResourceId.
drainTimeoutSecondsintSeconds the drain waits for the queue to empty when a host goes away. The appliance gives a drain command 300 seconds, so keep this below that.
enableKeyVaultPurgeProtectionboolPurge protection on the Key Vault. Default true; turn off only for throwaway deployments.
enableNoDeliveryAlertboolAlert when no mail was delivered for an hour inside business hours. Turn it off for a relay that legitimately carries no weekday traffic.
enableTelemetryboolEnable/Disable usage telemetry for module.
existingSubnetResourceIdstringResource ID of an existing, dedicated and empty subnet to place the relay in, instead of creating a VNet. See the container-appliance module for what that subnet must provide.
graphFailureAlertThresholdintThe graph-send-failures alert fires when the relay logs more than this many deferred or rejected Graph sends in 15 minutes.
hostPrivateIpAddressstringStatic private IP for the first host. Empty uses the container-appliance default.
imageReferencestringThe relay container image, <registry>/<repository>@sha256:<digest>. Always pinned by digest: the deployment fails without a 64-character @sha256: digest. The default is the vendor-neutral relay image at the digest built from relay commit 58bf566 (the build publishes the digest as a workflow output).
instanceCountintNumber of relay hosts, all active together behind the internal load balancer. Every host takes an address in the subnet.
itsmWebhookUristringITSM webhook URI for the action group.
keyVaultNamestringName of the appliance Key Vault. Empty derives it from the name.
locationstringAzure region to deploy the resources.
lockobjectA lock to apply to the whole resource group. NOT recommended: it stops Azure Resource Manager grooming deployment history and eventually fails every deployment. Use protectStatefulResources instead.
messageSizeLimitBytesintLargest message the relay accepts, in bytes. Graph rejects a message above its own limit, so keep this at or below it.
namestringShort name used to derive every resource name. Lowercase alphanumeric and hyphens, kept short.
protectStatefulResourcesboolCanNotDelete locks on each resource that holds state, instead of on the resource group. See the container-appliance module.
queuedMailAlertThresholdintThe queued-mail alert fires when a host has held more than this many messages for the whole 15-minute window.
relayHoststringNext hop Postfix names as relayhost. Mail is delivered through Graph, so this rarely matters.
relayHostPortintPort of relayHost.
resourceGroupNamestringName of the resource group this module creates. Defaults to name.
roleAssignmentsarrayAdditional role assignments to grant on this resource group.
scaleSetZonesarrayAvailability zones the scale set spreads across, for example [1, 2, 3]. Empty uses availabilityZone alone.
tagsobjectTags applied to every resource.
timeZonestringContainer time zone, for example Europe/Dublin.
virtualNetworkPeeringsarrayVNet peerings in the AVM shape. A remote side is a write outside the relay resource group. Ignored with existingSubnetResourceId.
vmSizestringVM size. Avoid burstable (B-series) sizes.
workspaceResourceIdstringResource ID of an existing Log Analytics workspace. Empty creates one in the resource group.
Parameter: graphClientId

Client (application) ID of the Entra app registration: single tenant, no public client flows, and the Mail.Send application permission only, admin-consented. The app registration is a prerequisite: it is a Graph object, not an ARM resource.

  • Required: Yes
  • Type: string
Parameter: graphClientSecret

Client secret of that app registration. Stored in the appliance Key Vault and written to an env file on the host at boot. Never part of the compose file.

  • Required: Yes
  • Type: securestring
Parameter: graphSenderMailbox

The mailbox Graph sends as. Every message is sent from this mailbox, whatever the original sender. It must be a real Exchange Online mailbox, shared (no licence needed) or licensed: a user whose licence was removed has no mailbox. Restrict the Entra app to it with an application access policy (see the README prerequisites).

  • Required: Yes
  • Type: string
Parameter: graphTenantId

Entra tenant ID of the app registration that sends the mail.

  • Required: Yes
  • Type: string
Parameter: inboundAllowedCidr

CIDR allowed inbound to the relay on port 25: the subnet the hub firewall forwards from. This module opens nothing else.

  • Required: Yes
  • Type: string
Parameter: mailDomain

The mail domain: Postfix mydomain and myorigin, for example contoso.com.

  • Required: Yes
  • Type: string
Parameter: myNetworks

Networks allowed to relay, as CIDRs. Used verbatim as Postfix mynetworks: nothing is added, so list loopback yourself if you need it. At least one entry.

  • Required: Yes
  • Type: array
Parameter: relayHostname

The name the relay announces: Postfix myhostname and the SMTP banner, for example smtp.contoso.com.

  • Required: Yes
  • Type: string
Parameter: senderAllowList

Sender addresses (or domain names, which match every address in them) allowed to send through the relay. The Graph mailbox is always allowed. Enforced for every client, trusted networks included. At least one entry.

  • Required: Yes
  • Type: array
Parameter: sshPublicKey

SSH public key for the admin account. Password sign-in is disabled.

  • Required: Yes
  • Type: string
Parameter: existingIdentityPrincipalId

Required if createNewManagedIdentity is false. Principal ID of the existing identity.

  • Required: No
  • Type: string
  • Default: ''
Parameter: existingIdentityResourceId

Required if createNewManagedIdentity is false. Resource ID of the existing identity.

  • Required: No
  • Type: string
  • Default: ''
Parameter: registryToken

Required if containerRegistry.mode is keyVaultToken. A read-only registry token (read:packages) issued to a service identity, never to a person. Stored in the appliance Key Vault as the secret named by containerRegistry.tokenSecretName.

  • Required: No
  • Type: securestring
  • Default: ''
Parameter: vnetAddressPrefix

Required if existingSubnetResourceId is empty. Address space for the relay’s own VNet, for example 10.20.0.0/24.

  • Required: No
  • Type: string
  • Default: ''
Parameter: adminUsername

Local admin username on the hosts.

  • Required: No
  • Type: string
  • Default: 'relayadmin'
Parameter: alertEmailAddresses

Email addresses added to the action group. A service desk mailbox turns each alert into a ticket.

  • Required: No
  • Type: array
  • Default: []
Parameter: applianceSubnetNewBits

Prefix length of the appliance subnet, carved as the first subnet of vnetAddressPrefix (27 = a /27, about 26 hosts). Despite the name, this is a prefix length.

  • Required: No
  • Type: int
  • Default: 27
Parameter: availabilityZone

Availability zone for the hosts that are not spread by scaleSetZones.

  • Required: No
  • Type: int
  • Default: 1
  • Allowed:
    [
      1
      2
      3
    ]
Parameter: businessHoursEndUtc

Business hours end at the start of this hour, UTC, 1 to 24. Weekdays only.

  • Required: No
  • Type: int
  • Default: 17
  • MinValue: 1
  • MaxValue: 24
Parameter: businessHoursStartUtc

First business hour, UTC, 0 to 23.

  • Required: No
  • Type: int
  • Default: 7
  • MinValue: 0
  • MaxValue: 23
Parameter: containerRegistry

How the hosts pull the relay image. The default is ghcr.io with a read-only token held in the appliance Key Vault (mode keyVaultToken, secret registry-token). The relay image package is private, so the token is needed. Use anonymous only if the package is public, or managedIdentity for an Azure Container Registry.

  • Required: No
  • Type: object
  • Default:
    {
        mode: 'keyVaultToken'
        server: 'ghcr.io'
        tokenSecretName: 'registry-token'
    }
  • MinValue: 0
  • MaxValue: 23

Required parameters

ParameterTypeDescription
modestringHow to authenticate: anonymous, managedIdentity or keyVaultToken.
serverstringRegistry server name, for example contoso.azurecr.io. Empty with mode anonymous.

Conditional parameters

ParameterTypeDescription
tokenSecretNamestringRequired if mode is keyVaultToken: name of the Key Vault secret (one of keyVaultSecrets) holding the registry token.

Optional parameters

ParameterTypeDescription
registryResourceIdstringmanagedIdentity only: resource ID of the Azure Container Registry, to grant the VM identity AcrPull on it.
tokenUsernamestringkeyVaultToken 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'
    ]
  • MinValue: 0
  • MaxValue: 23
Parameter: containerRegistry.server

Registry server name, for example contoso.azurecr.io. Empty with mode anonymous.

  • Required: Yes
  • Type: string
  • MinValue: 0
  • MaxValue: 23
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
  • MinValue: 0
  • MaxValue: 23
Parameter: containerRegistry.registryResourceId

managedIdentity only: resource ID of the Azure Container Registry, to grant the VM identity AcrPull on it.

  • Required: No
  • Type: string
  • MinValue: 0
  • MaxValue: 23
Parameter: containerRegistry.tokenUsername

keyVaultToken only: the user name that goes with the token.

  • Required: No
  • Type: string
  • MinValue: 0
  • MaxValue: 23
Parameter: containerRestartAlertThreshold

The container-restart alert fires when the relay container restarts more than this many times in 15 minutes.

  • Required: No
  • Type: int
  • Default: 3
  • MinValue: 1
  • MaxValue: 23
Parameter: createNatGateway

Create and associate a NAT Gateway for outbound egress. Ignored with existingSubnetResourceId.

  • Required: No
  • Type: bool
  • Default: True
  • MinValue: 1
  • MaxValue: 23
Parameter: createNewManagedIdentity

Create a new user-assigned identity (true) or attach an existing one (false).

  • Required: No
  • Type: bool
  • Default: True
  • MinValue: 1
  • MaxValue: 23
Parameter: defaultRouteNextHopIpAddress

Next-hop IP for a 0.0.0.0/0 route on the relay subnet, for example the hub firewall. Ignored with existingSubnetResourceId.

  • Required: No
  • Type: string
  • Default: ''
  • MinValue: 1
  • MaxValue: 23
Parameter: dnsServers

Custom DNS servers for the relay VNet. Ignored with existingSubnetResourceId.

  • Required: No
  • Type: array
  • Default: []
  • MinValue: 1
  • MaxValue: 23
Parameter: drainTimeoutSeconds

Seconds the drain waits for the queue to empty when a host goes away. The appliance gives a drain command 300 seconds, so keep this below that.

  • Required: No
  • Type: int
  • Default: 240
  • MinValue: 10
  • MaxValue: 280
Parameter: enableKeyVaultPurgeProtection

Purge protection on the Key Vault. Default true; turn off only for throwaway deployments.

  • Required: No
  • Type: bool
  • Default: True
  • MinValue: 10
  • MaxValue: 280
Parameter: enableNoDeliveryAlert

Alert when no mail was delivered for an hour inside business hours. Turn it off for a relay that legitimately carries no weekday traffic.

  • Required: No
  • Type: bool
  • Default: True
  • MinValue: 10
  • MaxValue: 280
Parameter: enableTelemetry

Enable/Disable usage telemetry for module.

  • Required: No
  • Type: bool
  • Default: True
  • MinValue: 10
  • MaxValue: 280
Parameter: existingSubnetResourceId

Resource ID of an existing, dedicated and empty subnet to place the relay in, instead of creating a VNet. See the container-appliance module for what that subnet must provide.

  • Required: No
  • Type: string
  • Default: ''
  • MinValue: 10
  • MaxValue: 280
Parameter: graphFailureAlertThreshold

The graph-send-failures alert fires when the relay logs more than this many deferred or rejected Graph sends in 15 minutes.

  • Required: No
  • Type: int
  • Default: 0
  • MinValue: 0
  • MaxValue: 280
Parameter: hostPrivateIpAddress

Static private IP for the first host. Empty uses the container-appliance default.

  • Required: No
  • Type: string
  • Default: ''
  • MinValue: 0
  • MaxValue: 280
Parameter: imageReference

The relay container image, <registry>/<repository>@sha256:<digest>. Always pinned by digest: the deployment fails without a 64-character @sha256: digest. The default is the vendor-neutral relay image at the digest built from relay commit 58bf566 (the build publishes the digest as a workflow output).

  • Required: No
  • Type: string
  • Default: 'ghcr.io/innofactororg/smtp-relay@sha256:e63ef9f00fbbc6f5b37c419e5e69a9035c081c91ff76a9d906c3400584e32d14'
  • MinValue: 0
  • MaxValue: 280
Parameter: instanceCount

Number of relay hosts, all active together behind the internal load balancer. Every host takes an address in the subnet.

  • Required: No
  • Type: int
  • Default: 2
  • MinValue: 1
  • MaxValue: 100
Parameter: itsmWebhookUri

ITSM webhook URI for the action group.

  • Required: No
  • Type: string
  • Default: ''
  • MinValue: 1
  • MaxValue: 100
Parameter: keyVaultName

Name of the appliance Key Vault. Empty derives it from the name.

  • Required: No
  • Type: string
  • Default: ''
  • MinValue: 1
  • MaxValue: 100
Parameter: location

Azure region to deploy the resources.

  • Required: No
  • Type: string
  • Default: 'westeurope'
  • MinValue: 1
  • MaxValue: 100
Parameter: lock

A lock to apply to the whole resource group. NOT recommended: it stops Azure Resource Manager grooming deployment history and eventually fails every deployment. Use protectStatefulResources instead.

  • Required: No
  • Type: object
  • MinValue: 1
  • MaxValue: 100

Optional parameters

ParameterTypeDescription
kindstringThe lock kind.
namestringName of the lock.
notesstringNotes about this lock.
Parameter: lock.kind

The lock kind.

  • Required: No
  • Type: string
  • Allowed:
    [
      'CanNotDelete'
      'None'
      'ReadOnly'
    ]
  • MinValue: 1
  • MaxValue: 100
Parameter: lock.name

Name of the lock.

  • Required: No
  • Type: string
  • MinValue: 1
  • MaxValue: 100
Parameter: lock.notes

Notes about this lock.

  • Required: No
  • Type: string
  • MinValue: 1
  • MaxValue: 100
Parameter: messageSizeLimitBytes

Largest message the relay accepts, in bytes. Graph rejects a message above its own limit, so keep this at or below it.

  • Required: No
  • Type: int
  • Default: 10240000
  • MinValue: 1
  • MaxValue: 100
Parameter: name

Short name used to derive every resource name. Lowercase alphanumeric and hyphens, kept short.

  • Required: No
  • Type: string
  • Default: 'smtprelay'
  • MinValue: 1
  • MaxValue: 100
Parameter: protectStatefulResources

CanNotDelete locks on each resource that holds state, instead of on the resource group. See the container-appliance module.

  • Required: No
  • Type: bool
  • Default: True
  • MinValue: 1
  • MaxValue: 100
Parameter: queuedMailAlertThreshold

The queued-mail alert fires when a host has held more than this many messages for the whole 15-minute window.

  • Required: No
  • Type: int
  • Default: 25
  • MinValue: 1
  • MaxValue: 100
Parameter: relayHost

Next hop Postfix names as relayhost. Mail is delivered through Graph, so this rarely matters.

  • Required: No
  • Type: string
  • Default: 'smtp.office365.com'
  • MinValue: 1
  • MaxValue: 100
Parameter: relayHostPort

Port of relayHost.

  • Required: No
  • Type: int
  • Default: 587
  • MinValue: 1
  • MaxValue: 100
Parameter: resourceGroupName

Name of the resource group this module creates. Defaults to name.

  • Required: No
  • Type: string
  • Default: [parameters('name')]
  • MinValue: 1
  • MaxValue: 100
Parameter: roleAssignments

Additional role assignments to grant on this resource group.

  • Required: No
  • Type: array
  • MinValue: 1
  • MaxValue: 100

Required parameters

ParameterTypeDescription
principalIdstringThe principal ID of the user, group, or service principal to assign the role to.
roleDefinitionIdOrNamestringThe role to assign — either a full role definition resource ID, or a bare role definition GUID (resolved against this subscription).

Optional parameters

ParameterTypeDescription
principalTypestringThe principal type of the assigned principal ID.
Parameter: roleAssignments.principalId

The principal ID of the user, group, or service principal to assign the role to.

  • Required: Yes
  • Type: string
  • MinValue: 1
  • MaxValue: 100
Parameter: roleAssignments.roleDefinitionIdOrName

The role to assign — either a full role definition resource ID, or a bare role definition GUID (resolved against this subscription).

  • Required: Yes
  • Type: string
  • MinValue: 1
  • MaxValue: 100
Parameter: roleAssignments.principalType

The principal type of the assigned principal ID.

  • Required: No
  • Type: string
  • Allowed:
    [
      'Device'
      'ForeignGroup'
      'Group'
      'ServicePrincipal'
      'User'
    ]
  • MinValue: 1
  • MaxValue: 100
Parameter: scaleSetZones

Availability zones the scale set spreads across, for example [1, 2, 3]. Empty uses availabilityZone alone.

  • Required: No
  • Type: array
  • Default: []
  • MinValue: 1
  • MaxValue: 100
Parameter: tags

Tags applied to every resource.

  • Required: No
  • Type: object
  • MinValue: 1
  • MaxValue: 100
Parameter: timeZone

Container time zone, for example Europe/Dublin.

  • Required: No
  • Type: string
  • Default: 'UTC'
  • MinValue: 1
  • MaxValue: 100
Parameter: virtualNetworkPeerings

VNet peerings in the AVM shape. A remote side is a write outside the relay resource group. Ignored with existingSubnetResourceId.

  • Required: No
  • Type: array
  • Default: []
  • MinValue: 1
  • MaxValue: 100
Parameter: vmSize

VM size. Avoid burstable (B-series) sizes.

  • Required: No
  • Type: string
  • Default: 'Standard_D2as_v5'
  • MinValue: 1
  • MaxValue: 100
Parameter: workspaceResourceId

Resource ID of an existing Log Analytics workspace. Empty creates one in the resource group.

  • Required: No
  • Type: string
  • Default: ''
  • MinValue: 1
  • MaxValue: 100

Outputs

OutputTypeDescription
actionGroupResourceIdstringResource ID of the action group the alerts notify.
applianceAddressstringAddress of the internal load balancer. Point the hub firewall DNAT and the internal relay name here.
applianceSubnetResourceIdstringResource ID of the relay subnet.
keyVaultNamestringName of the appliance Key Vault.
keyVaultUristringURI of the appliance Key Vault.
loadBalancerResourceIdstringResource ID of the internal load balancer.
manualStepsRequiredForReusearrayRole assignments the template could not make because an existing identity was reused. Empty for a new identity.
resourceGroupNamestringName of the resource group.
scaleSetResourceIdstringResource ID of the scale set that holds the relay hosts.
virtualNetworkResourceIdstringResource ID of the relay VNet. Empty when an existing subnet was used.
vmIdentityPrincipalIdstringPrincipal ID of the identity the hosts run as.
workspaceResourceIdstringResource ID of the Log Analytics workspace the alerts read.

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).

ReferenceType
br/innofactor:avm/ptn/lz/container-appliance:0.2.1Remote reference
br/public:avm/res/insights/scheduled-query-rule:0.5.1Remote reference

Notes

What this module is, and is not

A Postfix relay on N hosts behind an internal load balancer. Applications and appliances on the internal network send plain SMTP to one address; the relay hands each message to Microsoft Graph (sendMail) over HTTPS, as one mailbox, with an Entra app registration’s client secret. It is the SMTP front of Graph for senders that cannot speak OAuth.

It is a two-layer pattern. container-appliance 0.1.0 (in loadBalanced mode) provides the network, the scale set, the identity, the Key Vault, monitoring and generic alerts, and knows nothing about mail. This module adds what only the relay needs: the compose file rendered from parameters, the relay settings, the Graph secret, the drain command and the payload alerts. No file is edited by hand on a host.

Prerequisites this module does not create
  1. The sender mailbox (graphSenderMailbox). Every message leaves from this mailbox, whatever the original sender, so recipients see one address. The original sender is only checked against senderAllowList.
    • It must be a real Exchange Online mailbox: a shared mailbox (no licence needed) or a licensed user. A former licensed user whose licence was removed has no mailbox, and Graph answers MailboxNotEnabledForRESTAPI.
    • The relay sends with saveToSentItems, so a copy of every relayed message accumulates in this mailbox’s Sent Items. Agree a retention policy for it.
  2. An Entra app registration for Graph. It is a Graph object, not an ARM resource. The values go in graphTenantId, graphClientId and graphClientSecret.
    • Single tenant, no redirect URI, and no public client flows. The relay uses the client credentials flow, which needs neither.
    • The Mail.Send application permission only, with admin consent. A test app that reads back and deletes its message also needs Mail.ReadWrite (a Graph delete fails with Mail.Read); a production app never does.
    • Restrict it to the sender mailbox, so a leaked secret cannot send as anyone else. Until this is done, Mail.Send reaches every mailbox in the tenant. Existing relays use an Exchange application access policy; Microsoft’s successor is RBAC for Applications in Exchange Online, which needs the same verification.
      1. List the app’s existing policies first (Get-ApplicationAccessPolicy) and remove stale ones. A RestrictAccess policy scoped to a mailbox that was later deleted leaves the app able to reach nothing.
      2. New-ApplicationAccessPolicy -AppId <app> -PolicyScopeGroupId <sender-mailbox> -AccessRight RestrictAccess.
      3. Allow about an hour for propagation. Test-ApplicationAccessPolicy reports Granted at once, but Graph kept answering 403 ErrorAccessDenied for 62 minutes in the sandbox build. A 403 in that hour is expected; do not change permissions or recreate the policy because of it.
      4. Verify with a client-credentials token, not only with Test-ApplicationAccessPolicy: a Graph sendMail as the sender mailbox returns 202, and as any other mailbox 403. (An app that also holds a read permission can check GET /users/<mailbox>/mailFolders/inbox instead: 200 and 403.) Deploy the relay only after both answers are right.
      • The Exchange Online PowerShell device code (Connect-ExchangeOnline -Device) expires after 15 minutes, so have the Exchange administrator ready before starting.
    • The client secret expires. Put its expiry in a calendar, because the Graph-failures alert is how you would otherwise find out. It goes straight into graphClientSecret. The module stores it in the appliance Key Vault and writes the host’s runtime env file itself; never put it in a committed file, a ticket or on a workstation.
  3. A read-only registry token (registryToken, read:packages) for the private relay image package, issued to a service identity and never to a person.
  4. The hub side, which this module never writes:
    • a firewall DNAT rule from the published relay address to the applianceAddress output (the internal load balancer);
    • hub return routes for the relay subnet in every hub route table that carries the traffic (the GatewaySubnet and any NVA or route-server subnet), through the hubReturnRoutes list of the workload-networking module (0.4.11 or later). A half-applied set is the classic cause of asymmetric routing: the TCP connect succeeds and the SMTP banner never arrives.
    • the subnet’s inboundAllowedCidr is the source the firewall forwards from. The module opens port 25 from that CIDR and nothing else.
  5. An egress path for the hosts: the module’s NAT Gateway (default), or your own route through the hub firewall with defaultRouteNextHopIpAddress or existingSubnetResourceId. The firewall must allow the Docker and Ubuntu repositories, ghcr.io, Entra and Graph (login.microsoftonline.com, graph.microsoft.com) and Azure Key Vault.
How mail flows and what is protected
  • myNetworks is Postfix mynetworks, used verbatim. A client outside it cannot relay (454 Relay access denied). List loopback yourself if you need it.
  • senderAllowList is enforced for every client, trusted networks included. A sender that is not on it, and is not the Graph mailbox, is refused at RCPT (554).
  • A message is queued, then sent through Graph. If Graph refuses temporarily (network, token, 5xx, throttling, 401/403/404/408) Postfix defers and retries until the queue lifetime. Other 4xx answers bounce. A failed send never drops mail.
  • The queue is on each host’s OS volume: a loadBalanced host has no data disk. It survives a container restart and a recreate, not the loss of the host. On a scale-in, an update or a shutdown the appliance agent first takes the host out of the load balancer pool and waits out the probe (about 20 seconds), so clients are sent to the other hosts, then runs the drain command (docker exec postfix /scripts/drain.sh). The drain stops intake and waits up to drainTimeoutSeconds until the host is quiet (queue empty, no Graph send in progress, no client connected), then stops Postfix. If Graph is down the drain times out with mail queued and that mail is lost with the host, so do not scale in while the queued-mail alert is firing. A host that dies without a drain loses its queue (ADR 17, ADR 21).
  • Patching: the scale set hosts are patched by Azure’s automatic guest patching, in health-gated batches, at all hours. There is no patch window. State this to the people who depend on the relay.
Alerts

All notify the appliance action group (itsmWebhookUri, alertEmailAddresses) and auto-mitigate. They read the container logs in Log Analytics; the phrases they match are the relay image’s contract (ADR 18).

AlertFires whenSeverity
Relay Queue Backloga host’s smallest queue depth over 15 minutes is above queuedMailAlertThreshold2
Relay Graph Send Failuresmore than graphFailureAlertThreshold deferred or rejected Graph sends in 15 minutes1
Relay No Deliveriesno delivery for an hour, hosts reporting, weekdays inside businessHoursStartUtc to businessHoursEndUtc (UTC); switch off with enableNoDeliveryAlert3
Container Restartingthe relay container restarts more than containerRestartAlertThreshold times in 15 minutes (from the appliance)2

There is no connection monitor. “Connected” is not “answering”: the e2e probe checks for the SMTP banner and EHLO, not a TCP connect.

The image

imageReference is ghcr.io/innofactororg/smtp-relay by digest; the deployment fails without a digest (ADR 16). The package is private, so the default containerRegistry is keyVaultToken. To bump the image, take the digest from the relay build, change imageReference and redeploy; hosts roll one at a time through the scale set.

Tests
  • defaults: one host, own VNet. Through the load balancer address a client VM proves that the relay accepts mail from an allowed sender and refuses a sender that is not on the list, then sends a real message to a sandbox mailbox and proves, from the relay log (delivered via graph service for that queue ID) and then through Graph, that it reached the Inbox. It then deletes every copy of the test message (Inbox, and Sent Items when the sender mailbox is the recipient), requires 204 for each and proves none remain, so the sandbox mailbox ends each run clean. It needs a sandbox Entra app with Mail.Send and Mail.ReadWrite scoped to a sandbox mailbox, in the CI Key Vault as CI-graphTenantId, CI-graphClientId, CI-graphClientSecret and CI-graphTestMailbox. While any is missing the deployment fails at validation and names the parameter. The test is not skipped and nothing is faked.
  • waf-aligned: two hosts, a subnet the test brings, locks and an alert receiver. The client network is not in myNetworks; the test proves the relay answers EHLO and still refuses to relay for it.
  • Both need CI-ghcrReadToken for the private image.

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.0

Changes
  • Builds on container-appliance 0.2.1 (was 0.1.1). The relay hosts now send their logs to Log Analytics: load-balanced hosts are associated with the data collection rule by policy, which brings the relay’s payload alerts (queue backlog, Graph send failures, no deliveries) and queue depth to life. A scale-in now takes a host out of the load balancer before it drains, so callers no longer see refused connections (ADR 20, ADR 21).
  • The default relay image is the build of relay commit 58bf566, sha256:e63ef9f00fbbc6f5b37c419e5e69a9035c081c91ff76a9d906c3400584e32d14. Its drain waits until the queue is empty, nothing is being sent and no client is connected, and no longer reads a failed queue check as an empty queue.
Breaking Changes
  • Inherited from container-appliance 0.2.0: the identity that deploys the relay now needs to create a policy assignment and role assignments at the relay’s resource group (see the container-appliance 0.2.0 changelog).

0.1.1

Changes
  • Documentation only; the deployed resources are unchanged. The Graph prerequisites in the README and the graphSenderMailbox and graphClientId descriptions are corrected from a verified sandbox build: the sender must be a real Exchange mailbox (shared or licensed), the app is single tenant with no public client flows and Mail.Send only, stale access policies are removed first, the access policy takes about an hour to reach Graph (a 403 in that hour is expected), and access is verified with a client-credentials token. Sent Items keeps a copy of every relayed message.
Breaking Changes
  • None

0.1.0

Changes
  • First release of the module. A managed SMTP relay: Postfix on N hosts behind an internal load balancer, delivering mail through Microsoft Graph, with its own network (or a subnet you bring), Key Vault, monitoring and payload alerts. It renders the compose file from parameters and calls container-appliance 0.1.1 in loadBalanced mode. See the README for parameters and examples.
  • The relay image is the vendor-neutral ghcr.io/innofactororg/smtp-relay, pinned by digest. A deployment without a 64-character @sha256: digest fails. The package is private: the default containerRegistry is keyVaultToken with a read-only token you supply (ADR 16).
  • The queue is on each host’s OS volume, because a loadBalanced host has no data disk. A drain command runs before a host goes away: it stops intake, flushes the queue, waits and stops Postfix (ADR 17).
  • Payload alerts from the container logs: queue backlog, Graph send failures, and no deliveries in business hours, plus the appliance’s container-restart alert. There is no connection monitor (ADR 18).
  • Inbound is port 25 from inboundAllowedCidr only. The hub side (a firewall DNAT to the load balancer address, and hub return routes through workload-networking hubReturnRoutes) is a prerequisite the module does not write.
  • The Graph client secret goes to the appliance Key Vault and reaches the host through an env file. It is never part of the compose file or the deployment history.
  • Tests: defaults (one host, own VNet; SMTP through the load balancer accepts an allowed sender and refuses another, then a real message reaches a sandbox mailbox, proven from the relay log and through Graph) and waf-aligned (two hosts, a subnet you bring, locks, an untrusted client network that is refused). The real-Graph test reads the CI Key Vault secrets CI-graphTenantId, CI-graphClientId, CI-graphClientSecret and CI-graphTestMailbox and fails at validation, naming the parameter, while one is missing.
Breaking Changes
  • None

Version history

VersionPublished
0.2.02026-11-24
0.1.12026-11-20
0.1.02026-11-20