Skip to content

Commit 1cf69af

Browse files
Add support for excluding paths from Entra ID authentication (#270)
Allow container apps to specify paths (e.g., /healthcheck, /sha) that bypass authentication via the new auth_excluded_paths variable. Updated tfdocs
1 parent 49ca42d commit 1cf69af

4 files changed

Lines changed: 30 additions & 0 deletions

File tree

infrastructure/modules/container-app/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,21 @@ module "container-app" {
106106
}
107107
```
108108

109+
### Excluding paths from authentication
110+
111+
You can exclude specific paths from authentication using the `auth_excluded_paths` variable. These paths will respond without requiring authentication, which is useful for health checks or version endpoints.
112+
113+
Example:
114+
```hcl
115+
module "container-app" {
116+
...
117+
enable_entra_id_authentication = true
118+
auth_excluded_paths = ["/healthcheck", "/sha"]
119+
}
120+
```
121+
122+
By default, no paths are excluded (`auth_excluded_paths = []`).
123+
109124
## Alerts
110125

111126
To enable container app alerting:

infrastructure/modules/container-app/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ resource "azapi_resource" "auth" {
192192
}
193193
globalValidation = {
194194
unauthenticatedClientAction = var.unauthenticated_action
195+
excludedPaths = var.auth_excluded_paths
195196
}
196197
identityProviders = {
197198
azureActiveDirectory = {

infrastructure/modules/container-app/tfdocs.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ Type: `string`
8888

8989
Default: `null`
9090

91+
### <a name="input_auth_excluded_paths"></a> [auth\_excluded\_paths](#input\_auth\_excluded\_paths)
92+
93+
Description: List of paths to exclude from authentication (e.g., ["/healthcheck", "/sha"]). These paths will respond without requiring authentication.
94+
95+
Type: `list(string)`
96+
97+
Default: `[]`
98+
9199
### <a name="input_enable_alerting"></a> [enable\_alerting](#input\_enable\_alerting)
92100

93101
Description: Whether monitoring and alerting is enabled for the PostgreSQL Flexible Server.

infrastructure/modules/container-app/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ variable "unauthenticated_action" {
128128
}
129129
}
130130

131+
variable "auth_excluded_paths" {
132+
description = "List of paths to exclude from authentication (e.g., [\"/healthcheck\", \"/sha\"]). These paths will respond without requiring authentication."
133+
type = list(string)
134+
default = []
135+
}
136+
131137
# Always fetch the AAD client secret from Key Vault
132138
variable "infra_key_vault_name" {
133139
description = "Name of Key Vault to retrieve the AAD client secrets"

0 commit comments

Comments
 (0)