Skip to content

fix(docker): update OIDC Azure AD configuration and metadata URL handling#785

Merged
edmondas merged 7 commits intopoweradmin:masterfrom
jozefrebjak:fix-oidc-azure-conf-in-docker-entrypoint
Sep 24, 2025
Merged

fix(docker): update OIDC Azure AD configuration and metadata URL handling#785
edmondas merged 7 commits intopoweradmin:masterfrom
jozefrebjak:fix-oidc-azure-conf-in-docker-entrypoint

Conversation

@jozefrebjak
Copy link
Contributor

This pull request updates the OIDC Azure AD integration documentation and configuration logic to clarify tenant and metadata URL usage, improve configuration flexibility, and enhance user mapping. It also removes some legacy permission template mapping logic.

OIDC Azure AD Configuration Improvements:

  • Updated the DOCKER.md documentation for PA_OIDC_AZURE_TENANT to clarify that it accepts tenant ID, domain, or 'common', and for PA_OIDC_AZURE_METADATA_URL to specify that it is auto-generated if not provided. Added detailed configuration notes and example tenant values for better user guidance.
  • In docker-entrypoint.sh, the Azure metadata URL is now dynamically constructed using the actual tenant value if not explicitly set, ensuring correct endpoint configuration.

User Mapping and Permission Template Changes:

  • Updated the Azure user mapping to use email for the username and added the subject (sub) field for improved identity tracking.
  • Removed the permission_template_mapping and the environment variable override for default_permission_template, simplifying the permission template logic. [1] [2]

@edmondas edmondas self-assigned this Sep 21, 2025
@edmondas edmondas added auth Authentication infra Performance & Infrastructure labels Sep 21, 2025
@edmondas edmondas added this to the v4.1.0 milestone Sep 21, 2025
@jozefrebjak
Copy link
Contributor Author

@edmondas can you merge this or do I need to update something ?

Thanks

@edmondas
Copy link
Member

@edmondas can you merge this or do I need to update something ?

@jozefrebjak I have added some comments, so I'm not sure if you can see those :)

@jozefrebjak
Copy link
Contributor Author

@edmondas can you merge this or do I need to update something ?

@jozefrebjak I have added some comments, so I'm not sure if you can see those :)

I can't see any comments

Copy link
Member

@edmondas edmondas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at my comments

@edmondas
Copy link
Member

I can't see any comments

@jozefrebjak What about now? I think I forgot to submit my review... It's quite unusual that there's an additional step - I expected my comments to be visible instantly.

'tenant' => '${PA_OIDC_AZURE_TENANT:-common}',
'auto_discovery' => ${oidc_azure_auto_discovery},
'metadata_url' => '${PA_OIDC_AZURE_METADATA_URL:-https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration}',
'metadata_url' => '${azure_metadata_url}',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some improvements to URL handling and added special placeholders (see commit 641d7b9), so in this case I feel that this URL handling is not required—just use the URL like this:
https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration

| `PA_OIDC_AZURE_TENANT` | Tenant ID, domain, or 'common' for multi-tenant | `common` | No |
| `PA_OIDC_AZURE_AUTO_DISCOVERY` | Use auto-discovery | `true` | No |
| `PA_OIDC_AZURE_METADATA_URL` | Metadata URL for discovery | Azure's standard URL | No |
| `PA_OIDC_AZURE_METADATA_URL` | Custom metadata URL (auto-generated if not provided) | `https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration` | No |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's needed, as this is controlled through PA_OIDC_AZURE_TENANT

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edmondas If it's done within backend and we only need to set tenant then it's not needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jozefrebjak Could you clean this up? I feel this parameter is not required because it will be built based on the PA_OIDC_AZURE_TENANT value by the backend. Thanks.


# Add Azure configuration if enabled
if [ "${oidc_azure_enabled}" = "true" ]; then
# Build the metadata URL with the actual tenant value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now done on the backend side, so not sure if it's still relevant

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jozefrebjak cleanup this as well

@edmondas edmondas merged commit 438d0af into poweradmin:master Sep 24, 2025
3 checks passed
@edmondas
Copy link
Member

edmondas commented Sep 25, 2025

@jozefrebjak Thanks for your contribution and sorry for bothering you with the changes! I went ahead and did some of the cleanups we discussed in the review: removed the manual URL building logic in the Docker entrypoint script and now use the simple template URL with {tenant} placeholder, also removed the PA_OIDC_AZURE_METADATA_URL environment variable since Azure uses a predictable standard endpoint. The implementation now properly uses the existing URL template processing instead of duplicating logic in the shell script.

This was referenced Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth Authentication infra Performance & Infrastructure

Development

Successfully merging this pull request may close these issues.

2 participants