Skip to content

BYOC on Microsoft Azure ​

Three options: Azure Container Instances (simplest), Azure Container Apps with TCP ingress, or a VM with Docker. Read the BYOC overview first.

Option A: Azure Container Instances ​

bash
az group create -n connectmq-rg -l westeurope

az container create -g connectmq-rg -n connectmq-broker \
  --image connectmqcom/broker:1.0.0 \
  --os-type Linux --cpu 1 --memory 2 \
  --ports 1883 8883 8083 8084 \
  --ip-address Public --dns-name-label my-connectmq \
  --restart-policy Always \
  --environment-variables BROKER_ID=my-broker-01 PUBLIC_BROKER_ENABLED=false \
  --secure-environment-variables BROKER_SECRET_KEY='<your-secret>'

The broker is reachable at my-connectmq.westeurope.azurecontainer.io. Client source IPs are preserved.

TLS in ACI ​

Deploy with YAML and mount the certificate as a secret volume (values are base64-encoded):

yaml
apiVersion: '2021-10-01'
location: westeurope
name: connectmq-broker
type: Microsoft.ContainerInstance/containerGroups
properties:
  osType: Linux
  restartPolicy: Always
  ipAddress:
    type: Public
    dnsNameLabel: my-connectmq
    ports: [{port: 1883, protocol: TCP}, {port: 8883, protocol: TCP},
            {port: 8083, protocol: TCP}, {port: 8084, protocol: TCP}]
  containers:
  - name: broker
    properties:
      image: connectmqcom/broker:1.0.0
      resources: {requests: {cpu: 1, memoryInGB: 2}}
      ports: [{port: 1883}, {port: 8883}, {port: 8083}, {port: 8084}]
      environmentVariables:
      - {name: BROKER_ID, value: my-broker-01}
      - {name: PUBLIC_BROKER_ENABLED, value: "false"}
      - {name: BROKER_SECRET_KEY, secureValue: <your-secret>}
      volumeMounts:
      - {name: certs, mountPath: /app/certs, readOnly: true}
  volumes:
  - name: certs
    secret:
      broker.pem: <base64 of fullchain+privkey PEM>
bash
az container create -g connectmq-rg --file aci.yaml

Option B: Azure Container Apps (TCP ingress) ​

TCP ingress needs a Container Apps environment with your own VNet:

bash
az containerapp env create -g connectmq-rg -n connectmq-env -l westeurope \
  --infrastructure-subnet-resource-id <SUBNET_ID>

az containerapp create -g connectmq-rg -n connectmq-broker --environment connectmq-env \
  --image connectmqcom/broker:1.0.0 --cpu 1 --memory 2Gi \
  --min-replicas 1 --max-replicas 1 \
  --ingress external --transport tcp --target-port 1883 --exposed-port 1883 \
  --secrets broker-secret='<your-secret>' \
  --env-vars BROKER_ID=my-broker-01 PUBLIC_BROKER_ENABLED=false BROKER_SECRET_KEY=secretref:broker-secret

To expose 8083, 8883 and 8084 too, add them as additionalPortMappings in the app's ingress configuration. Keep max-replicas at 1.

Option C: Azure VM ​

Create an Ubuntu VM (or an Ampere Dpsv5 VM for arm64), install Docker and follow Docker / Docker Compose. Open the ports in the Network Security Group.

Secrets ​

Store BROKER_SECRET_KEY and the certificate in Azure Key Vault and reference them from Container Apps or your deployment pipeline.

Not supported on Azure ​

Application Gateway and Front Door (layer 7). Use Azure Load Balancer (layer 4) if you need a load balancer in front.

Next: Verify, update & troubleshoot.

Fully managed MQTT broker for connected devices.