Deploy DQE One Standalone as a single Azure Container App (DQE One + Redis sidecar) in an internal Container Apps environment, backed by Azure Database for PostgreSQL Flexible Server and exposed via an Application Gateway.
Note: All elements described below are recommendations from DQE, based on deployment experience with different customers. The customer is responsible for integrating the solution into their own architecture. An architect familiar with the customer context and internal infrastructure should align DQE's recommendations with the client infrastructure. This guide is the Azure Container Apps (ACA) counterpart of Azure ACI — Standalone installation.
Validation status: the Application Gateway, custom domain and DNS steps (sections 2.3 and 3.2 to 3.5) are still being validated. The Terraform reference (Appendix A) has not been tested and is provided as a starting point.
Main differences with the ACI installation
| Topic | ACI | ACA |
|---|---|---|
| Hosting unit | Container group | Container app (main container + sidecars) |
| Reverse proxy | NGINX sidecar | Built-in ACA ingress (Envoy) — no NGINX needed |
| Inter-container traffic | localhost |
localhost (containers of one app share the same network namespace) |
| PostgreSQL | Container on Azure Files (SMB) | Azure Database for PostgreSQL Flexible Server (recommended) |
| Subnet delegation | Microsoft.ContainerInstance/containerGroups |
Microsoft.App/environments |
| Secrets | secureValue |
configuration.secrets + secretRef
|
| Logs |
diagnostics.logAnalytics on the group |
Log Analytics attached to the ACA environment |
| App Gateway backend | Private IP of the ACI, HTTP 80 | Static IP of the ACA environment, HTTPS 443 |
| Persistent volumes | Azure Files on the group | Azure Files registered on the environment |
1. Architecture
DQE One Standalone runs as one container app with two containers (dqeone and a redis sidecar) that share the same network namespace and talk through localhost. The ACA environment is internal: only the Application Gateway has a public IP and routes HTTPS traffic to the environment through the private VNET.
Recommended architecture
Internet / users
| HTTPS 443
Application Gateway (WAF v2, public IP, TLS termination) - appgw-subnet
| HTTPS 443, host name preserved
ACA environment (internal) - aca-subnet
|
ACA ingress (environment static IP) -> port 8000
|
Container app dqe-standalone
|-- dqeone (DQE One Standalone, port 8000)
| |-- localhost:6379 --> redis (Redis sidecar, port 6379)
| | |-- SMB mount /data --> Azure Files (share redisdata)
| '-- port 5432, TLS --> PostgreSQL Flexible Server (pg-subnet)
'-- logs (console + system) --> Log AnalyticsThe ACA built-in ingress replaces the NGINX sidecar of the ACI installation; PostgreSQL moves to a managed Flexible Server reachable on its private IP.
Security measures
- Application Gateway: terminates HTTPS and filters inbound IP ranges through the WAF. It is the only public entry point.
- Internal ACA environment: no public IP; the app is reachable only from the VNET through the environment static IP.
- PostgreSQL Flexible Server: private access only (VNET integration, private DNS zone) and TLS-encrypted connections.
- SSL certificate: the same certificate is used on the Application Gateway listener and on the custom domain of the container app.
-
Secrets: stored in
configuration.secretsand injected withsecretRef; Azure Key Vault references are recommended for production (see Appendix A.6 bis).
Recommended sizing
| Component | CPU | Memory |
|---|---|---|
dqeone container |
1.0 vCPU | 2 Gi |
redis container |
0.5 vCPU | 1 Gi |
| Container app total | 1.5 vCPU | 3 Gi |
| PostgreSQL Flexible Server | General Purpose Standard_D2ds_v5 (2 vCores) |
8 GiB |
On the Consumption workload profile, the CPU/memory total of an app must match a supported pair (0.5 Gi per 0.25 vCPU) and is limited to 4 vCPU / 8 Gi. Above this, use a Dedicated workload profile.
2. Installation
2.1. Azure CLI
Azure CLI must be installed on your local machine, with the Container Apps extension.
Linux / macOS
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bashWindows
Refer to the Microsoft documentation.
Then install the extension and register the providers:
az login
az extension add --name containerapp --upgrade
az provider register --namespace Microsoft.App
az provider register --namespace Microsoft.OperationalInsights
az provider register --namespace Microsoft.DBforPostgreSQLPrerequisite: registering a resource provider requires permissions at subscription level (for example Owner or Contributor on the subscription). With Contributor on a resource group only, az provider register fails with AuthorizationFailed: ask a subscription administrator to register Microsoft.App and the other providers before starting. Check their state with:
for p in Microsoft.App Microsoft.OperationalInsights Microsoft.DBforPostgreSQL Microsoft.Network Microsoft.Storage; do
echo "$p : $(az provider show -n $p --query registrationState -o tsv)"
doneAll five must show Registered.
2.2. Create the VNET and subnets
Three dedicated subnets are required. Adapt the address ranges to your network plan.
| Subnet | Example range | Delegation | Purpose |
|---|---|---|---|
appgw-subnet |
10.0.1.0/24 | None | Application Gateway |
aca-subnet |
10.0.2.0/27 (minimum) | Microsoft.App/environments |
Container Apps environment |
pg-subnet |
10.0.3.0/28 | Microsoft.DBforPostgreSQL/flexibleServers |
PostgreSQL Flexible Server |
az network vnet create \
--resource-group MY_RESOURCE_GROUP \
--name MY_VNET \
--location MY_LOCATION \
--address-prefixes 10.0.0.0/16
az network vnet subnet create -g MY_RESOURCE_GROUP --vnet-name MY_VNET \
-n appgw-subnet --address-prefixes 10.0.1.0/24
az network vnet subnet create -g MY_RESOURCE_GROUP --vnet-name MY_VNET \
-n aca-subnet --address-prefixes 10.0.2.0/27 \
--delegations Microsoft.App/environments
az network vnet subnet create -g MY_RESOURCE_GROUP --vnet-name MY_VNET \
-n pg-subnet --address-prefixes 10.0.3.0/28 \
--delegations Microsoft.DBforPostgreSQL/flexibleServersNote the full resource ID of aca-subnet — it is required in section 2.6:
az network vnet subnet show -g MY_RESOURCE_GROUP --vnet-name MY_VNET \
-n aca-subnet --query id -o tsvIf an NSG is attached to aca-subnet, allow inbound TCP 443 from appgw-subnet.
2.3. Create an Application Gateway
The Application Gateway exposes the application with a public IP address, terminates HTTPS and filters inbound IP ranges through the WAF. For full configuration details, refer to the Microsoft Application Gateway documentation.
-
Basic tab: select your subscription, resource group and region. Choose the WAF V2 tier. Use the VNET from section 2.2 and the
appgw-subnetsubnet. - WAF policy: create a new WAF policy and define the inbound IP ranges authorised to call the Application Gateway (corporate network, partner ranges).
- Frontends: create a new public IP address.
- Backends: create a backend pool and leave it empty for now — the static IP of the ACA environment is added in section 3.3.
-
Routing rule — Listener: HTTPS on port 443, with your SSL certificate (PFX), host name
standalone.yourdomain.com. - Routing rule — Backend setting: HTTPS on port 443, Override with new host name: No (the original host name is preserved and routed by ACA, see section 3.2), Request time-out: 240 seconds (the default of 20 seconds is too short for long DQE requests).
Click Review + create.
2.4. Create the PostgreSQL database
ACA volumes are Azure File Shares (SMB), which do not support the POSIX operations required by PostgreSQL. The recommended database is therefore Azure Database for PostgreSQL — Flexible Server, deployed with private access in pg-subnet.
Step 1 — Create a private DNS zone and link it to the VNET. The zone name must end with .postgres.database.azure.com and must not be built from the server name (the CLI rejects MY_PG_SERVER.private.postgres.database.azure.com with PrivateDnsZoneNameNotValid). Passing the zone resource ID to the create command avoids this validation issue.
az network private-dns zone create \
--resource-group MY_RESOURCE_GROUP \
--name dqe-standalone.postgres.database.azure.com
az network private-dns link vnet create \
--resource-group MY_RESOURCE_GROUP \
--zone-name dqe-standalone.postgres.database.azure.com \
--name link-MY_VNET \
--virtual-network MY_VNET \
--registration-enabled false
az network private-dns zone show \
--resource-group MY_RESOURCE_GROUP \
--name dqe-standalone.postgres.database.azure.com \
--query id -o tsvStep 2 — Create the server, passing the zone resource ID returned above as PRIVATE_DNS_ZONE_ID:
az postgres flexible-server create \
--resource-group MY_RESOURCE_GROUP \
--name MY_PG_SERVER \
--location MY_LOCATION \
--version 16 \
--tier GeneralPurpose \
--sku-name Standard_D2ds_v5 \
--storage-size 32 \
--admin-user dqeone \
--admin-password DATABASE_PASSWORD \
--vnet MY_VNET \
--subnet pg-subnet \
--private-dns-zone PRIVATE_DNS_ZONE_ID \
--yesStep 3 — Create the dqeone database. Recent CLI versions accept --database-name on create only for elastic clusters, so the database is created separately:
az postgres flexible-server db create \
--resource-group MY_RESOURCE_GROUP \
--server-name MY_PG_SERVER \
--name dqeoneThe server hostname MY_PG_SERVER.postgres.database.azure.com then resolves to a private IP from the VNET. Confirm with DQE the PostgreSQL major version to use before deploying.
SKU availability: Burstable SKUs (Standard_B1ms, Standard_B2s, Standard_B2ms) can be refused with SkuNotAvailable on some subscriptions, even when az postgres flexible-server list-skus lists them for the region. In that case, use General Purpose Standard_D2ds_v5. A failed attempt keeps the server name reserved for a few minutes while it is dropped (ServerNameAlreadyExists): retry with another name or wait.
Cost: to save costs outside business hours on a test environment, stop the server with az postgres flexible-server stop and restart it with az postgres flexible-server start. A stopped server is restarted automatically after 7 days.
2.5. Configure Azure Storage and Log Analytics
Storage. Only Redis needs a persistent volume (NGINX and the PostgreSQL container are no longer used).
az storage account create \
--name MY_STORAGE_ACCOUNT \
--resource-group MY_RESOURCE_GROUP \
--location MY_LOCATION \
--sku Standard_LRS
az storage account keys list \
--account-name MY_STORAGE_ACCOUNT \
--resource-group MY_RESOURCE_GROUP \
--query "[0].value" -o tsv
az storage share create \
--name redisdata \
--account-name MY_STORAGE_ACCOUNT \
--account-key MY_STORAGE_ACCOUNT_KEYLog Analytics. Create the workspace and retrieve its ID and primary key:
az monitor log-analytics workspace create \
--resource-group MY_RESOURCE_GROUP \
--workspace-name dqe-standalone-logs \
--location MY_LOCATION
az monitor log-analytics workspace show \
--resource-group MY_RESOURCE_GROUP \
--workspace-name dqe-standalone-logs \
--query customerId -o tsv
az monitor log-analytics workspace get-shared-keys \
--resource-group MY_RESOURCE_GROUP \
--workspace-name dqe-standalone-logs \
--query primarySharedKey -o tsv2.6. Create the Container Apps environment
The environment is internal: it gets a private static IP in aca-subnet and is not reachable from the internet.
az containerapp env create \
--name dqe-standalone-env \
--resource-group MY_RESOURCE_GROUP \
--location MY_LOCATION \
--enable-workload-profiles \
--infrastructure-subnet-resource-id SUBNET_RESOURCE_ID \
--internal-only true \
--logs-destination log-analytics \
--logs-workspace-id LOG_ANALYTICS_WORKSPACE_ID \
--logs-workspace-key LOG_ANALYTICS_WORKSPACE_KEY--logs-destination log-analytics is set explicitly because Microsoft has announced that its default value will change to azure-monitor in a future CLI release.
Retrieve the environment static IP (used by the Application Gateway) and resource ID (used in the YAML):
az containerapp env show -n dqe-standalone-env -g MY_RESOURCE_GROUP \
--query properties.staticIp -o tsv
az containerapp env show -n dqe-standalone-env -g MY_RESOURCE_GROUP \
--query id -o tsvRegister the Redis file share on the environment:
az containerapp env storage set \
--name dqe-standalone-env \
--resource-group MY_RESOURCE_GROUP \
--storage-name redisdata \
--azure-file-account-name MY_STORAGE_ACCOUNT \
--azure-file-account-key MY_STORAGE_ACCOUNT_KEY \
--azure-file-share-name redisdata \
--access-mode ReadWrite2.7. Container app YAML
Create a file named containerapp.yaml. Replace all placeholders before deploying.
| Placeholder | Description |
|---|---|
MY_LOCATION |
Azure region, for example westeurope
|
ENVIRONMENT_RESOURCE_ID |
Environment resource ID retrieved in section 2.6 |
DQE_REGISTRY_LOGIN / DQE_REGISTRY_PASSWORD
|
Registry credentials provided by DQE |
ADMIN_USER / ADMIN_PASSWORD
|
Initial administrator account |
CLIENT_LICENCE |
Customer licence key provided by DQE |
SECRET_ENCRYPTION_KEY_VALUE |
Encryption key generated once (section 2.8) |
DATABASE_PASSWORD |
PostgreSQL password set in section 2.4 |
MY_PG_SERVER |
PostgreSQL Flexible Server name |
YOUR_DNS_NAME |
Public DNS name, for example standalone.yourdomain.com
|
AUTHORIZED_SFTP_HOSTS |
Comma-separated list of authorised SFTP hosts |
DYNAMICS_TENANT_ID |
Microsoft Entra tenant ID of the App registration used for Microsoft Dynamics (section 2.8) |
DYNAMICS_CLIENT_ID |
Application (client) ID of this App registration |
DYNAMICS_CLIENT_SECRET |
Client secret of this App registration |
name: dqe-standalone
location: MY_LOCATION
type: Microsoft.App/containerApps
properties:
managedEnvironmentId: ENVIRONMENT_RESOURCE_ID
workloadProfileName: Consumption
configuration:
activeRevisionsMode: Single
ingress:
external: true # reachable from the VNET (the environment itself is internal)
targetPort: 8000
transport: http
allowInsecure: false
registries:
- server: dqeone.azurecr.io
username: DQE_REGISTRY_LOGIN
passwordSecretRef: registry-password
secrets:
- name: registry-password
value: DQE_REGISTRY_PASSWORD
- name: admin-password
value: ADMIN_PASSWORD
- name: client-licence
value: CLIENT_LICENCE
- name: secret-encryption-key
value: SECRET_ENCRYPTION_KEY_VALUE
- name: db-password
value: DATABASE_PASSWORD
- name: dynamics-login-client-secret
value: DYNAMICS_CLIENT_SECRET
template:
containers:
- name: dqeone
image: dqeone.azurecr.io/standalone:v1.4.0
command: ["bash", "./entrypoint.sh"]
resources:
cpu: 1.0
memory: 2Gi
env:
- name: SFAPIVERSION
value: "65.0"
- name: CREATE_SUPERUSER
value: "true"
- name: RUN_COLLECTSTATIC
value: "false"
- name: DQE_ONE_SERVER_ADMIN_USER
value: ADMIN_USER
- name: DQE_ONE_SERVER_ADMIN_PASSWORD
secretRef: admin-password
- name: DQE_CLIENT_LICENCE
secretRef: client-licence
- name: WEBSITE_HOSTNAME
value: https://YOUR_DNS_NAME
- name: SECRET_ENCRYPTION_KEY
secretRef: secret-encryption-key
- name: WAIT_HOSTS
value: "localhost:6379"
- name: WAIT_HOSTS_TIMEOUT
value: "300"
- name: WAIT_SLEEP_INTERVAL
value: "5"
- name: WAIT_HOST_CONNECT_TIMEOUT
value: "30"
- name: REDIS_URL
value: redis://localhost:6379
- name: PORT
value: "8000"
- name: DEBUG
value: "false"
- name: DB_USER
value: dqeone
- name: DB_PASSWORD
secretRef: db-password
- name: DB_NAME
value: dqeone
- name: DB_HOST
value: MY_PG_SERVER.postgres.database.azure.com
- name: DB_VOLUME_PATH
value: ./db/
- name: DB_MAX_CAPACITY
value: "8000000000"
- name: AUTHORIZED_SFTP_HOSTS
value: AUTHORIZED_SFTP_HOSTS
- name: DYNAMICS_LOGIN_TENANT_ID
value: DYNAMICS_TENANT_ID
- name: DYNAMICS_LOGIN_CLIENT_ID
value: DYNAMICS_CLIENT_ID
- name: DYNAMICS_LOGIN_CLIENT_SECRET
secretRef: dynamics-login-client-secret
- name: redis
image: dqeone.azurecr.io/dqe-one-redis:v1.0
resources:
cpu: 0.5
memory: 1Gi
volumeMounts:
- volumeName: redisdata
mountPath: /data
scale:
minReplicas: 1
maxReplicas: 1
volumes:
- name: redisdata
storageType: AzureFile
storageName: redisdataImportant: use the image versions provided by DQE. Do not replace them with the latest tag.
Replicas: keep minReplicas and maxReplicas at 1. Redis runs as a sidecar, so each extra replica would get its own Redis instance. A minimum of 1 also prevents the application from scaling to zero.
Secrets: this file contains secrets in clear text — do not commit it to source control. For production, prefer Azure Key Vault references (keyVaultUrl + managed identity) in configuration.secrets.
2.8. Environment variables
Variables are identical to the ACI installation, with three changes:
| Variable | ACA value | Change compared with ACI |
|---|---|---|
DB_HOST |
MY_PG_SERVER.postgres.database.azure.com |
Managed server hostname instead of localhost
|
DB_USER / DB_PASSWORD / DB_NAME
|
Credentials set in section 2.4 | Must match the Flexible Server |
DQE_CLIENT_LICENCE |
secretRef: client-licence |
Stored as a secret |
REDIS_URL (redis://localhost:6379) and WAIT_HOSTS (localhost:6379) keep localhost, because the containers of one app share the same network namespace. All other variables (SFAPIVERSION, CREATE_SUPERUSER, WEBSITE_HOSTNAME, DEBUG, etc.) keep the meaning described in the ACI article.
Microsoft Dynamics login (SSO): three variables in the dqeone container refer to the Azure App registration used to connect DQE One with Microsoft Dynamics. They let users log in to the Standalone with their Microsoft Dynamics account ("Login with Dynamics" button, displayed only when the user comes from a Dynamics organisation through the managed package). The same values are needed to add Microsoft Dynamics as a credential in the Standalone.
| Variable | Value |
|---|---|
DYNAMICS_LOGIN_TENANT_ID |
Microsoft Entra tenant ID of the App registration |
DYNAMICS_LOGIN_CLIENT_ID |
Application (client) ID of the App registration |
DYNAMICS_LOGIN_CLIENT_SECRET |
Client secret of the App registration, stored as a secret (secretRef) |
Important: the SECRET_ENCRYPTION_KEY must be generated once and kept for the lifetime of the deployment:
python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"3. Launcher
3.1. Deploy the container app
az containerapp create \
--name dqe-standalone \
--resource-group MY_RESOURCE_GROUP \
--environment dqe-standalone-env \
--yaml containerapp.yamlFirst deployment failing with UNAUTHORIZED: the first az containerapp create can fail with UNAUTHORIZED: authentication required on both images, even with valid registry credentials, and leave the app in the Failed state. Creating a new revision fixes it:
az containerapp update \
--name dqe-standalone \
--resource-group MY_RESOURCE_GROUP \
--revision-suffix r2If the error persists, check the credentials as described in section 5.
The app is reachable only from the VNET, through the environment static IP retrieved in section 2.6.
3.2. Bind the custom domain on the container app
ACA ingress routes requests by host name. Binding the public DNS name on the app lets the Application Gateway forward the original host name unchanged, so the application receives the same host as WEBSITE_HOSTNAME.
Step 1 — Upload the SSL certificate (PFX) to the environment. Managed certificates are not available for internal environments.
az containerapp env certificate upload \
--name dqe-standalone-env \
--resource-group MY_RESOURCE_GROUP \
--certificate-file ./standalone.pfx \
--password PFX_PASSWORD \
--certificate-name standalone-certStep 2 — Retrieve the domain verification ID and create a TXT record asuid.standalone with this value in your public DNS zone:
az containerapp show -n dqe-standalone -g MY_RESOURCE_GROUP \
--query properties.customDomainVerificationId -o tsvStep 3 — Add and bind the host name:
az containerapp hostname add \
--name dqe-standalone \
--resource-group MY_RESOURCE_GROUP \
--hostname standalone.yourdomain.com
az containerapp hostname bind \
--name dqe-standalone \
--resource-group MY_RESOURCE_GROUP \
--environment dqe-standalone-env \
--hostname standalone.yourdomain.com \
--certificate standalone-cert \
--validation-method TXT3.3. Set up the Application Gateway backend pool
Go to Azure Portal > Application Gateway > Backend pools > your backend pool > Edit. Add the static IP of the ACA environment (section 2.6) as target. Click Save.
If your certificate is issued by an internal CA, set Use well known CA certificate: No in the backend setting and upload the root CA certificate.
3.4. Set up the Application Gateway health probe
Go to Azure Portal > Application Gateway > Health probes > Add:
- Protocol: HTTPS
-
Host:
standalone.yourdomain.com - Pick host name from backend settings: No
-
Path:
/ - Backend settings: the HTTPS 443 setting created in section 2.3
Click Test. If the status shows Healthy, click Add.
3.5. Set up DNS
Contact your DNS administrators to create the following records:
| Record type | Name | Value |
|---|---|---|
| A | standalone.yourdomain.com |
Public IP of the Application Gateway |
| TXT | asuid.standalone.yourdomain.com |
Domain verification ID (section 3.2) |
3.6. Verify the installation
Check the app, its revision and its replica:
az containerapp show -n dqe-standalone -g MY_RESOURCE_GROUP \
--query "{Status:properties.runningStatus, Fqdn:properties.configuration.ingress.fqdn}" -o table
az containerapp revision list -n dqe-standalone -g MY_RESOURCE_GROUP \
--query "[].{Revision:name, Health:properties.healthState, Replicas:properties.replicas}" -o table
az containerapp replica list -n dqe-standalone -g MY_RESOURCE_GROUP -o tableExpected: running status Running, revision health Healthy, 1 replica.
Note: the dqeone and redis containers start simultaneously. The WAIT_HOSTS mechanism handles the startup order. A delay of 1–2 minutes before the application is fully operational is expected on first start (database migrations, superuser creation).
Once DNS has propagated, navigate to https://standalone.yourdomain.com.
4. IP Addresses to Authorise
Once the application is running, configure the WAF or upstream firewall to authorise the following inbound IP ranges:
- DQE Software Office Server: contact DQE Software support to obtain the IP address to authorise.
- DQE Deduplication Service: contact DQE Software support to obtain the IP address to authorise.
- DQE Quality Service: contact DQE Software support to obtain the IP address to authorise.
Action required: provide DQE Software with the outbound public IP address of the ACA environment. To get a fixed outbound IP, attach a NAT Gateway (with a static public IP) to aca-subnet — this requires a workload profiles environment, as created in section 2.6.
5. Troubleshooting
View container logs
Logs are available in Log Analytics in the ContainerAppConsoleLogs_CL (application output) and ContainerAppSystemLogs_CL (platform events) tables. You can also stream them via CLI:
az containerapp logs show \
--name dqe-standalone \
--resource-group MY_RESOURCE_GROUP \
--container CONTAINER_NAME \
--follow
# Platform events (image pull, probes, restarts)
az containerapp logs show -n dqe-standalone -g MY_RESOURCE_GROUP --type systemTo open a shell in a container: az containerapp exec -n dqe-standalone -g MY_RESOURCE_GROUP --container dqeone.
Unauthorised while pulling images
If the credentials are valid (the check below returns the list of tags) and the app was created in the Failed state, run az containerapp update -n dqe-standalone -g MY_RESOURCE_GROUP --revision-suffix r2 to create a new revision (see section 3.1).
To check the credentials and the available image versions:
for REPO in standalone dqe-one-redis; do
TOKEN=$(curl -s -u "DQE_REGISTRY_LOGIN:DQE_REGISTRY_PASSWORD" \
"https://dqeone.azurecr.io/oauth2/token?service=dqeone.azurecr.io&scope=repository:$REPO:pull" \
| sed -n 's/.*"access_token":"\([^"]*\)".*/\1/p')
curl -s -H "Authorization: Bearer $TOKEN" "https://dqeone.azurecr.io/v2/$REPO/tags/list"; echo
doneOtherwise, verify that:
- the
registriessection contains the login provided by DQE and theregistry-passwordsecret contains the right password; - all images reference the DQE production registry
dqeone.azurecr.io; - the image versions match those provided by DQE.
The dqeone container cannot reach PostgreSQL
Verify that:
-
DB_HOSTis the full hostnameMY_PG_SERVER.postgres.database.azure.com; - the private DNS zone of the server is linked to the VNET of the ACA environment;
-
DB_USER,DB_PASSWORDandDB_NAMEmatch the Flexible Server (admin userdqeone, databasedqeone); - TLS is accepted by the client: Flexible Server enforces encrypted connections by default (
require_secure_transport = ON).
Revision stays Unhealthy or restarts in a loop
Check the system logs for probe failures. On first start, migrations can take longer than the default startup probe; add a TCP startup probe on port 8000 with a longer failureThreshold in the dqeone container. Also check that the total resources of the app (1.5 vCPU / 3 Gi) remain within the Consumption limits.
Application Gateway health probe fails (502)
Verify that:
- the revision is
Healthyand has 1 running replica; - the backend pool contains the static IP of the ACA environment;
- the custom domain
standalone.yourdomain.comis bound on the app (section 3.2) and the backend setting does not override the host name; - the probe host is
standalone.yourdomain.comand the protocol is HTTPS; - the NSG on
aca-subnetallows inbound TCP 443 fromappgw-subnet.
Requests time out (504)
ACA ingress closes HTTP requests after 240 seconds; this limit cannot be raised. Check that the Application Gateway backend setting request time-out is set to 240 seconds. Long-running processing should run asynchronously in DQE One rather than in a single HTTP request.
Redis fails to write to its volume
Check that the redisdata storage is registered on the environment with --access-mode ReadWrite and that the storage account key is still valid. If the key has been rotated, run az containerapp env storage set again with the new key and restart the revision.
Appendix A — Terraform reference (azurerm 4.x)
This appendix translates sections 2 and 3 into Terraform resources for teams that deploy as code. It has not been tested yet: use it as a starting point and adapt it to your modules, naming conventions and secret management (for example Azure Key Vault, see A.6 bis). The resource group is assumed to exist.
Resource providers: by default the azurerm provider tries to register resource providers, which requires subscription-level rights. If the pipeline identity only has rights on the resource group, register the providers listed in section 2.1 beforehand and set resource_provider_registrations = "none" in the provider block.
First apply: as with the CLI (section 3.1), the first creation of the container app can fail with UNAUTHORIZED on the images, or because a Key Vault role assignment (A.6 bis) has not propagated yet. Run terraform apply again.
A.1. Provider and variables
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 4.0"
}
}
}
provider "azurerm" {
features {}
subscription_id = var.subscription_id
# resource_provider_registrations = "none"
}
variable "subscription_id" { type = string }
variable "resource_group_name" { type = string }
variable "location" { default = "francecentral" }
variable "prefix" { default = "dqe-standalone" }
variable "storage_account_name" { type = string } # 3-24 lowercase letters and digits, globally unique
variable "hostname" { type = string } # e.g. standalone.yourdomain.com
variable "authorized_sftp_hosts" { default = "" }
variable "admin_user" { type = string }
variable "registry_username" { type = string }
variable "pfx_path" { type = string }
variable "dynamics_tenant_id" { type = string } # App registration used for Dynamics
variable "dynamics_client_id" { type = string }
variable "db_password" { sensitive = true }
variable "registry_password" { sensitive = true }
variable "admin_password" { sensitive = true }
variable "client_licence" { sensitive = true }
variable "secret_encryption_key" { sensitive = true }
variable "dynamics_client_secret" { sensitive = true }
variable "pfx_password" { sensitive = true }A.2. Network
resource "azurerm_virtual_network" "vnet" {
name = "${var.prefix}-vnet"
location = var.location
resource_group_name = var.resource_group_name
address_space = ["10.0.0.0/16"]
}
resource "azurerm_subnet" "appgw" {
name = "appgw-subnet"
resource_group_name = var.resource_group_name
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = ["10.0.1.0/24"]
}
resource "azurerm_subnet" "aca" {
name = "aca-subnet"
resource_group_name = var.resource_group_name
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = ["10.0.2.0/27"]
delegation {
name = "aca"
service_delegation {
name = "Microsoft.App/environments"
actions = ["Microsoft.Network/virtualNetworks/subnets/join/action"]
}
}
}
resource "azurerm_subnet" "pg" {
name = "pg-subnet"
resource_group_name = var.resource_group_name
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = ["10.0.3.0/28"]
delegation {
name = "pg"
service_delegation {
name = "Microsoft.DBforPostgreSQL/flexibleServers"
actions = ["Microsoft.Network/virtualNetworks/subnets/join/action"]
}
}
}A.3. PostgreSQL Flexible Server
resource "azurerm_private_dns_zone" "pg" {
name = "${var.prefix}.postgres.database.azure.com"
resource_group_name = var.resource_group_name
}
resource "azurerm_private_dns_zone_virtual_network_link" "pg" {
name = "${var.prefix}-pg-link"
resource_group_name = var.resource_group_name
private_dns_zone_name = azurerm_private_dns_zone.pg.name
virtual_network_id = azurerm_virtual_network.vnet.id
}
resource "azurerm_postgresql_flexible_server" "pg" {
name = "${var.prefix}-pg"
resource_group_name = var.resource_group_name
location = var.location
version = "16"
delegated_subnet_id = azurerm_subnet.pg.id
private_dns_zone_id = azurerm_private_dns_zone.pg.id
public_network_access_enabled = false
administrator_login = "dqeone"
administrator_password = var.db_password
sku_name = "GP_Standard_D2ds_v5"
storage_mb = 32768
depends_on = [azurerm_private_dns_zone_virtual_network_link.pg]
lifecycle {
ignore_changes = [zone]
}
}
resource "azurerm_postgresql_flexible_server_database" "dqeone" {
name = "dqeone"
server_id = azurerm_postgresql_flexible_server.pg.id
charset = "UTF8"
collation = "en_US.utf8"
}A.4. Storage and Log Analytics
resource "azurerm_storage_account" "sa" {
name = var.storage_account_name
resource_group_name = var.resource_group_name
location = var.location
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_storage_share" "redis" {
name = "redisdata"
storage_account_id = azurerm_storage_account.sa.id
quota = 5
}
resource "azurerm_log_analytics_workspace" "law" {
name = "${var.prefix}-logs"
resource_group_name = var.resource_group_name
location = var.location
sku = "PerGB2018"
retention_in_days = 30
}A.5. Container Apps environment
resource "azurerm_container_app_environment" "env" {
name = "${var.prefix}-env"
resource_group_name = var.resource_group_name
location = var.location
log_analytics_workspace_id = azurerm_log_analytics_workspace.law.id
infrastructure_subnet_id = azurerm_subnet.aca.id
internal_load_balancer_enabled = true
workload_profile {
name = "Consumption"
workload_profile_type = "Consumption"
}
}
resource "azurerm_container_app_environment_storage" "redis" {
name = "redisdata"
container_app_environment_id = azurerm_container_app_environment.env.id
account_name = azurerm_storage_account.sa.name
share_name = azurerm_storage_share.redis.name
access_key = azurerm_storage_account.sa.primary_access_key
access_mode = "ReadWrite"
}A.6. Container app
locals {
dqeone_env = {
SFAPIVERSION = "65.0"
CREATE_SUPERUSER = "true"
RUN_COLLECTSTATIC = "false"
DQE_ONE_SERVER_ADMIN_USER = var.admin_user
WEBSITE_HOSTNAME = "https://${var.hostname}"
WAIT_HOSTS = "localhost:6379"
WAIT_HOSTS_TIMEOUT = "300"
WAIT_SLEEP_INTERVAL = "5"
WAIT_HOST_CONNECT_TIMEOUT = "30"
REDIS_URL = "redis://localhost:6379"
PORT = "8000"
DEBUG = "false"
DB_USER = "dqeone"
DB_NAME = "dqeone"
DB_HOST = azurerm_postgresql_flexible_server.pg.fqdn
DB_VOLUME_PATH = "./db/"
DB_MAX_CAPACITY = "8000000000"
AUTHORIZED_SFTP_HOSTS = var.authorized_sftp_hosts
DYNAMICS_LOGIN_TENANT_ID = var.dynamics_tenant_id
DYNAMICS_LOGIN_CLIENT_ID = var.dynamics_client_id
}
# environment variable => secret name
dqeone_secret_env = {
DQE_ONE_SERVER_ADMIN_PASSWORD = "admin-password"
DQE_CLIENT_LICENCE = "client-licence"
SECRET_ENCRYPTION_KEY = "secret-encryption-key"
DB_PASSWORD = "db-password"
DYNAMICS_LOGIN_CLIENT_SECRET = "dynamics-login-client-secret"
}
}
resource "azurerm_container_app" "app" {
name = "dqe-standalone"
resource_group_name = var.resource_group_name
container_app_environment_id = azurerm_container_app_environment.env.id
revision_mode = "Single"
workload_profile_name = "Consumption"
secret {
name = "registry-password"
value = var.registry_password
}
secret {
name = "admin-password"
value = var.admin_password
}
secret {
name = "client-licence"
value = var.client_licence
}
secret {
name = "secret-encryption-key"
value = var.secret_encryption_key
}
secret {
name = "db-password"
value = var.db_password
}
secret {
name = "dynamics-login-client-secret"
value = var.dynamics_client_secret
}
registry {
server = "dqeone.azurecr.io"
username = var.registry_username
password_secret_name = "registry-password"
}
ingress {
external_enabled = true # reachable from the VNET (internal environment)
target_port = 8000
transport = "http"
allow_insecure_connections = false
traffic_weight {
latest_revision = true
percentage = 100
}
}
template {
min_replicas = 1
max_replicas = 1
container {
name = "dqeone"
image = "dqeone.azurecr.io/standalone:v1.4.0"
cpu = 1.0
memory = "2Gi"
command = ["bash", "./entrypoint.sh"]
dynamic "env" {
for_each = local.dqeone_env
content {
name = env.key
value = env.value
}
}
dynamic "env" {
for_each = local.dqeone_secret_env
content {
name = env.key
secret_name = env.value
}
}
}
container {
name = "redis"
image = "dqeone.azurecr.io/dqe-one-redis:v1.0"
cpu = 0.5
memory = "1Gi"
volume_mounts {
name = "redisdata"
path = "/data"
}
}
volume {
name = "redisdata"
storage_type = "AzureFile"
storage_name = azurerm_container_app_environment_storage.redis.name
}
}
}A.6 bis. Secrets from Azure Key Vault (recommended)
In A.6, secret values are passed as Terraform variables and end up in the Terraform state. The recommended alternative is to store them in Azure Key Vault: the container app reads them at runtime through a user-assigned managed identity, and Terraform only handles references.
Secrets to create in the Key Vault (suggested names):
| Key Vault secret | Container app secret | Content |
|---|---|---|
dqe-registry-password |
registry-password |
Password of the DQE registry dqeone.azurecr.io
|
dqe-admin-password |
admin-password |
Password of the DQE One administrator account |
dqe-client-licence |
client-licence |
Customer licence key provided by DQE |
dqe-secret-encryption-key |
secret-encryption-key |
Encryption key, generated once per environment |
dqe-db-password |
db-password |
PostgreSQL administrator password |
dqe-dynamics-login-client-secret |
dynamics-login-client-secret |
Client secret of the App registration used for Dynamics |
Prerequisites:
- The example assumes a Key Vault using the Azure RBAC permission model. With access policies, replace the role assignment with an
azurerm_key_vault_access_policy. - Creating the role assignment requires Owner or User Access Administrator on the Key Vault for the pipeline identity. Otherwise, an administrator creates it beforehand.
- If the Key Vault is behind a firewall or a private endpoint, the Container Apps environment must reach it from its VNET.
variable "key_vault_name" { type = string }
variable "key_vault_resource_group_name" { type = string }
data "azurerm_key_vault" "kv" {
name = var.key_vault_name
resource_group_name = var.key_vault_resource_group_name
}
# PostgreSQL password: read by Terraform to create the server (A.3).
# Use data.azurerm_key_vault_secret.db_password.value as administrator_password.
# The value is stored in the Terraform state, which must be secured.
data "azurerm_key_vault_secret" "db_password" {
name = "dqe-db-password"
key_vault_id = data.azurerm_key_vault.kv.id
}
resource "azurerm_user_assigned_identity" "app" {
name = "${var.prefix}-id"
resource_group_name = var.resource_group_name
location = var.location
}
resource "azurerm_role_assignment" "kv" {
scope = data.azurerm_key_vault.kv.id
role_definition_name = "Key Vault Secrets User"
principal_id = azurerm_user_assigned_identity.app.principal_id
}
locals {
# container app secret name => Key Vault secret name
kv_secrets = {
"registry-password" = "dqe-registry-password"
"admin-password" = "dqe-admin-password"
"client-licence" = "dqe-client-licence"
"secret-encryption-key" = "dqe-secret-encryption-key"
"db-password" = "dqe-db-password"
"dynamics-login-client-secret" = "dqe-dynamics-login-client-secret"
}
}
resource "azurerm_container_app" "app" {
# ... same arguments as in A.6, with the six secret blocks replaced by:
identity {
type = "UserAssigned"
identity_ids = [azurerm_user_assigned_identity.app.id]
}
dynamic "secret" {
for_each = local.kv_secrets
content {
name = secret.key
identity = azurerm_user_assigned_identity.app.id
key_vault_secret_id = "${data.azurerm_key_vault.kv.vault_uri}secrets/${secret.value}"
}
}
depends_on = [azurerm_role_assignment.kv]
}The registry, ingress and template blocks are unchanged: they keep referring to the secrets by their container app names (registry-password, db-password, etc.). With this variant, the registry_password, admin_password, db_password, client_licence, secret_encryption_key and dynamics_client_secret variables of A.1 are no longer needed.
Certificate: the PFX certificate can also be stored in the Key Vault and used by the Application Gateway and the Container Apps environment through a managed identity. Check that your azurerm version supports Key Vault certificates on azurerm_container_app_environment_certificate; otherwise keep the PFX upload of A.7.
A.7. Custom domain and outputs
The TXT record asuid.<hostname> must exist with the value of custom_domain_verification_id before the custom domain resource is created (see section 3.2). In practice, apply up to the container app first, create the DNS records, then apply the custom domain.
resource "azurerm_container_app_environment_certificate" "cert" {
name = "standalone-cert"
container_app_environment_id = azurerm_container_app_environment.env.id
certificate_blob_base64 = filebase64(var.pfx_path)
certificate_password = var.pfx_password
}
resource "azurerm_container_app_custom_domain" "domain" {
name = var.hostname
container_app_id = azurerm_container_app.app.id
container_app_environment_certificate_id = azurerm_container_app_environment_certificate.cert.id
certificate_binding_type = "SniEnabled"
}
output "environment_static_ip" {
value = azurerm_container_app_environment.env.static_ip_address # Application Gateway backend pool
}
output "custom_domain_verification_id" {
value = azurerm_container_app.app.custom_domain_verification_id # TXT record asuid.<hostname>
}A.8. Application Gateway
Use your standard Application Gateway module (azurerm_application_gateway, WAF v2) with the settings of sections 2.3, 3.3 and 3.4:
-
Backend pool:
environment_static_ipoutput. - Backend setting: HTTPS, port 443, no host name override, request timeout 240 seconds.
-
Listener: HTTPS 443 with the PFX certificate, host name
var.hostname. -
Health probe: HTTPS, host
var.hostname, path/.