harbor
harbor copied to clipboard
Harbor and Azure Active Directory
Hi All, I would like to know if Harbor supports authentication via Azure Active Directory, is there any documentation about that integration ?
Many thanks.
It is not supported. Can you please test and let us know if there are any issues, and we can support from there? @roldancer
This works when using the oicd provider.
- Create an app registraion in azure ad. Note down the tenant id and client id.
- Create a secret for the app registration. Note down the secret.
- In Harbor select the oicd authentication method.
- The name can be anything you want.
- The endpoint is https://login.microsoftonline.com/{tenant-id}/v2.0 (note that it does not end with a /, and does not include the ".well-known/openid-configuration" part).
- Enter the client-id and secret
- Use the scope "openid,email,profile" (no spaces).
- Testing the connection should work.
- Save, log out and try to login using the "Login using OICD" button.
This works when using the oicd provider.
- Create an app registraion in azure ad. Note down the tenant id and client id.
- Create a secret for the app registration. Note down the secret.
- In Harbor select the oicd authentication method.
- The name can be anything you want.
- The endpoint is https://login.microsoftonline.com/{tenant-id}/v2.0 (note that it does not end with a /, and does not include the ".well-known/openid-configuration" part).
- Enter the client-id and secret
- Use the scope "openid,email,profile" (no spaces).
- Testing the connection should work.
- Save, log out and try to login using the "Login using OICD" button.
Thanks for the info!!!! What would be the redirect URL for application registration in Azure AD?
This works when using the oicd provider.
- Create an app registraion in azure ad. Note down the tenant id and client id.
- Create a secret for the app registration. Note down the secret.
- In Harbor select the oicd authentication method.
- The name can be anything you want.
- The endpoint is https://login.microsoftonline.com/{tenant-id}/v2.0 (note that it does not end with a /, and does not include the ".well-known/openid-configuration" part).
- Enter the client-id and secret
- Use the scope "openid,email,profile" (no spaces).
- Testing the connection should work.
- Save, log out and try to login using the "Login using OICD" button.
Thanks for the info!!!! What would be the redirect URL for application registration in Azure AD?
No worries, i got my answer. It's at the bottom of the OIDC page.
@stonezdj It seems to me that this issue can be considered resolved as of @yaron's answer. I can also confirm that it works using OIDC with Azure AD, or at least to the same degree as Harbor works with any OIDC provider.
@jeremy-chua
No worries, i got my answer. It's at the bottom of the OIDC page.
Mind sharing this answer in this issue thread? It looks to me it has been removed from the documentation.
@jeremy-chua It is a misunderstanding. The information is not covered in the documentation, but in the bottom if the configuration page of the harbor instance WebUI.
@jeremy-chua It is a misunderstanding. The information is not covered in the documentation, but in the bottom if the configuration page of the harbor instance WebUI.
Yes, you are right. It's like a fine print. :)
This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.
This works when using the oicd provider.
- Create an app registraion in azure ad. Note down the tenant id and client id.
- Create a secret for the app registration. Note down the secret.
- In Harbor select the oicd authentication method.
- The name can be anything you want.
- The endpoint is https://login.microsoftonline.com/{tenant-id}/v2.0 (note that it does not end with a /, and does not include the ".well-known/openid-configuration" part).
- Enter the client-id and secret
- Use the scope "openid,email,profile" (no spaces).
- Testing the connection should work.
- Save, log out and try to login using the "Login using OICD" button.
@yaron @xaleeks any information on connecting groups to Azure AD?
This works when using the oicd provider.
- Create an app registraion in azure ad. Note down the tenant id and client id.
- Create a secret for the app registration. Note down the secret.
- In Harbor select the oicd authentication method.
- The name can be anything you want.
- The endpoint is https://login.microsoftonline.com/{tenant-id}/v2.0 (note that it does not end with a /, and does not include the ".well-known/openid-configuration" part).
- Enter the client-id and secret
- Use the scope "openid,email,profile" (no spaces).
- Testing the connection should work.
- Save, log out and try to login using the "Login using OICD" button.
@yaron @xaleeks any information on connecting groups to Azure AD?
You set Group Claim Name to groups then the groups can be referred to by their ID. It doesn't give you their name field though, so you gotta figure out what ID is what group yourself, but it works.
Just want to document how I got it working in 2022. The steps above are correct but there's a couple other things to note
- Azure Active Directory -->
App Registrations
-->New Registration
-
Name it whatever you want
-
Choose
Accounts in this organizational directory only
(though your use case may vary) -
Redirect URI:
Web
<-- This is important. Make the value:https://YOUR-CORE-HARBOR-DOMAIN/c/oidc/callback
<<- This value is also on the bottom of theConfiguration --> Authentication
tab in the Harbor dashboard. -
Make note of the
Application (client) ID
& theDirectory (tenant) ID
-
Click
Certificates & secrets
-->Client secrets
-->+New client secret
. Have it expire whenever you want to rotate it. Copy this value.
- In the Harbor dashboard go to
Configuration
-->Authentication
-
Auth Mode
-->OIDC
-
OIDC Endpoint
-->https://login.microsoftonline.com/TENANT ID FROM ABOVE/v2.0
-
OIDC Client ID
-->CLIENT ID FROM ABOVE
-
OIDC Client Secret
-->SECRET FROM ABOVE
-
Group Claim Name
-->groups
-
OIDC Scope
-->openid,email,profile,offline_access
Save it.
This will now enable a Groups
tab in the Harbor dashboard. It's going to be populated with the Azure AD Object ID
of the groups found. I believe it's populated with groups found by users who login.
Have your users go to the Harbor dashboard login screen and choose LOGIN VIA OIDC PROVIDER
and they should get it. They do get to choose their user name in Harbor though it is defaults to Firstname_Lastname
as a suggestion.
Once logged in they'll have access to basically nothing until you add them to Projects. I added an Azure AD groups Object ID
to a project and those users have the specified level of access to that Harbor project now. It doesn't look like Group Name works - you have to use Object ID
.
Once logged in I can go to my User Profile
and grab the CLI secret
, which is what I can use in my docker/podman client to push/pull from the Project(s) my group has access to. User name is whatever is chosen when first registering/logging in.
Hope this helps someone!
Does anyone know if it's possible to use Azure AD groups instead of Windows AD groups synced in Azure? We tried many different configurations in Azure including using App Roles, but I think these aren't supported?
Azure AD groups should have unique ids like Windows groups. Get the ID and set that. If it still doesn't work then you misconfiguration something. Azure AD and Windows Server groups are typically on the same domain within your organisation, so you should have both available to set.
On Fri, 20 Jan 2023, 15:20 UPiotr, @.***> wrote:
Does anyone know if it's possible to use Azure AD groups instead of Windows AD groups synced in Azure? We tried many different configurations in Azure including using App Roles, but I think these aren't supported?
— Reply to this email directly, view it on GitHub https://github.com/goharbor/harbor/issues/9193#issuecomment-1398460294, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3RH6OXWHRZOPTOUPLMMCDDWTKNLNANCNFSM4IZEMIRA . You are receiving this because you commented.Message ID: @.***>
I managed to get to working by settings additional group claim on Azure AD side in AppRegistration settings. Then all AD groups have been populated into Harbor using their GroupID.
Edit: still have issue to claim groups....
I managed to get to working by settings additional group claim on Azure AD side in AppRegistration settings. Then all AD groups have been populated into Harbor using their GroupID.
Edit: still have issue to claim groups....
Hello, if you have set up Azure AD OIDC auth, then you have to go to
App Registrations >> your harbor app >> Token configuration >> + Add groups claim >> Security groups >> ID >> Group ID >> Access >> Group ID >> SAML >> Group ID.
Like this, when some user will login through OIDC, there will appear group id's in Groups.
But now i need to learn, how to use group names instead of id's.
@olinigorov #12178 - sorry, not really possible out of the box.
@olinigorov did you get the group mapping working this way ? it set person of the group as admin ? in which version of harbor ?
I went with Dex in between AAD and Harbor. i.e.:
Harbor -> (oidc) -> Dex -> (microsoft) -> Azure AD
ref: https://dexidp.io/docs/connectors/microsoft/
Dex uses the Microsoft Graph API to enrich the OIDC token group claim with group names.
I might be able to get rid of Dex once I have access to this AzureAD feature: https://learn.microsoft.com/en-us/azure/active-directory/hybrid/connect/how-to-connect-fed-group-claims#emit-cloud-only-group-display-name-in-token - which is currently in preview.
You can use "app roles " in your azure app registration , link the roles to an azure ad group
As "Group Claim" use "roles"
Group Claim Name --> roles
(https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/groups-concept)
I found a solution for using the group names that requires editing the azure ad application manifest: https://github.com/goharbor/harbor/issues/12178#issuecomment-1853650100
Just for additional context. if you define Azure/Entera groups for users, and also use app_roles
, make sure to map the app_roles
to your Azure/Entera groups in the Enterprise Application
location of your app registration, using the Edit Assignment
button.
You will still get an error in the harbor-core logs about Unable to get groups from claims
, but roles and permissions should be mapped correctly, and users will have correct permissions. Inside Harbor, users will have the admin flag set to Unknown
.