Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to lookup AzureAD users #661

Open
csrvsk opened this issue Feb 12, 2025 · 35 comments
Open

Unable to lookup AzureAD users #661

csrvsk opened this issue Feb 12, 2025 · 35 comments

Comments

@csrvsk
Copy link

csrvsk commented Feb 12, 2025

Hi,

I have the latest version of Jenkins and also the latest version of the plugin-Microsoft Entra ID.

I am able to setup security Realm - Azure Active Directory. And able to verify configuration with users. But the problem is with the Authorization strategy -AzureAD Matrix Authorization Strategy.
And while setting up we need to first add the users and required groups by searching the name. It is giving me error

Image

Please provide any inputs to this issue.

Thanks
vsk

@timja
Copy link
Member

timja commented Feb 12, 2025

After verifying you need to save and refresh the page for it work.

Add authenticated users as administrator for the first configuration

(I can't see an existing open issue, but its a limitation of how the security page is designed)

@csrvsk
Copy link
Author

csrvsk commented Feb 12, 2025

Hi, I really appreciate the quick response,

That is already done. For now as work around I have updated the config.xml file with the required permissions set for the Azure user with associated Object_ID. Users got the access. But, previously I have added the plugin to other jenkins instances. Even now, on those instances I am able to search for the users directly on the UI, without any issues.

I want to be able to search for the users first. That is the main goal. Because, it will allow us to add new Azure users/groups if needed with the required permissions.

One more issue is nothing is logged anywhere about the issue. Please advice.

Thanks
vsk

@timja
Copy link
Member

timja commented Feb 12, 2025

check the browser console and the server logs.
What permission is assigned to your service principal?

@csrvsk
Copy link
Author

csrvsk commented Feb 12, 2025

Nothing is being logged in the browser console for logs.

Issue is not the permissions, it is not even able to find the Azure users/groups when typed in search bar under "Authorization section"

I mean look at this

Image

@timja
Copy link
Member

timja commented Feb 12, 2025

If Add user and Add group buttons are showing that means the disable graph integration is enabled which means it can't check those.

Have a look further up in the page (its not in your screenshot)

@csrvsk
Copy link
Author

csrvsk commented Feb 12, 2025

It is not enabled for sure, please take a look

Image

@timja
Copy link
Member

timja commented Feb 12, 2025

possible to take a full page screenshot? (hide whatever config you need)

and make sure you've definitely saved and refreshed
Ideally include the browser console in the screenshot too

@csrvsk
Copy link
Author

csrvsk commented Feb 12, 2025

Here you go

Image

Image

Image

Image

this is the last section

Image

And now the problem is
unable to lookup the Azure users to add them here
For reference on other jenkins instance - may little older version of the plugin is able to find and the user/group dispalying their object_ID as well

Image

As soon as you click on the search option it is able to populate few users on other jenkins instance.

Image

@csrvsk
Copy link
Author

csrvsk commented Feb 12, 2025

And on the current jenkins even it is not able to add the groups manually.

Image

But same group can be found on the other instance without any issues.

Hope I gave you enough screenshots to look into.

@timja
Copy link
Member

timja commented Feb 12, 2025

yeah the other instance is doing what I would expect.

Looking at the code the only time the Add user and Add group buttons are set are when disableGraphIngration is:
https://github.com/jenkinsci/azure-ad-plugin/blob/master/src/main/resources/com/microsoft/jenkins/azuread/AzureAdMatrixAuthorizationStrategy/config.jelly#L187-L203

Can you check the config.xml configuration on the file system in Jenkins home for the security realm config?

@csrvsk
Copy link
Author

csrvsk commented Feb 12, 2025

There is no problem in the security realm, Authentication is working fine.
Only thing is, it is unable to search for the Azure users/groups in the Authorization section.

It is able to add the users when we manually update the config file with the user/group we wanted, it is working for that group. But it is unable to add the user/groups through the UI part. That is very inconvenient as compared to the instance on which it is working fine.

@csrvsk
Copy link
Author

csrvsk commented Feb 12, 2025

And also please confirm one thing for this authorization of AzureAD Matrix Strategy.
Is it suppose to be Security Groups on Azure or Email groups? or Both works?
Because each instance is acting in a different way.

@timja
Copy link
Member

timja commented Feb 12, 2025

Can you check the xml config though and make sure the graph integration isn’t disabled.

I’m not 100% sure email groups may have been hidden in the person/group picker

@csrvsk
Copy link
Author

csrvsk commented Feb 12, 2025

What does this mean ? how to check it?

I’m not 100% sure email groups may have been hidden in the person/group picker

@csrvsk
Copy link
Author

csrvsk commented Feb 13, 2025

Please advice on DEBUG this issue.

On a side note could you please provide clear step-by-step process for setup on AzureApp?
We have created an app for Jenkins, and added around redirect URIs of 10 different jenkins instances. Upto 5-6 instances we did not get this issue which were integrated like a month ago. Now recently this week we tried to add 3 different instances, which are giving the same current issue.

Is it the plugin version or Jenkins version causing this issue?
If you can provide an exact Jenkins - EntraID plugin version compatibility matrix, that might help us to narrow down.

Please advice.

Thanks
vsk

@timja
Copy link
Member

timja commented Feb 13, 2025

Steps are here:
https://github.com/jenkinsci/azure-ad-plugin#setup-in-microsoft-entra-id

If you can provide an exact Jenkins - EntraID plugin version compatibility matrix, that might help us to narrow down.

Any version that lets you install the plugin should be compatible just fine.

I just tested the latest version of the plugin on Jenkins 2.497 and it worked fine for me


Can you please open config.xml inside of Jenkins home, search for securityRealm and provide the configuration inside it.

**** out the clientId, clientVersion, and tenant.

Can you also provide a screenshot that shows the plugin version and Jenkins version.

@csrvsk
Copy link
Author

csrvsk commented Feb 13, 2025

here is the whole config file

<?xml version='1.1' encoding='UTF-8'?>
<hudson>
  <disabledAdministrativeMonitors>
    <string>jenkins.security.csrf.CSRFAdministrativeMonitor</string>
    <string>jenkins.diagnostics.ControllerExecutorsNoAgents</string>
    <string>hudson.util.DoubleLaunchChecker</string>
  </disabledAdministrativeMonitors>
  <version>2.482</version>
  <numExecutors>4</numExecutors>
  <mode>NORMAL</mode>
  <useSecurity>true</useSecurity>
  <authorizationStrategy class="com.microsoft.jenkins.azuread.AzureAdMatrixAuthorizationStrategy">
    <permission>GROUP:hudson.model.Hudson.Administer:-jenkins-administrators</permission>
    <permission>USER:hudson.model.Hudson.Administer:[email protected]</permission>
    <permission>GROUP:hudson.model.Hudson.Read:authenticated</permission>
    <permission>GROUP:hudson.model.Hudson.Read:ship (155bec56-8bd0-4ff0-91f0-xxxxxxxxxxx)</permission>
    <permission>USER:hudson.model.Hudson.Read:2355774d-4e69-4d33-a24c-xxxxxxxxxxx</permission>
    <permission>USER:hudson.model.Hudson.Read:anonymous</permission>
    <permission>GROUP:hudson.model.Item.Build:ship (155bec56-8bd0-4ff0-91f0-xxxxxxxxxxx)</permission>
    <permission>USER:hudson.model.Item.Build:2355774d-4e69-4d33-a24c-xxxxxxxxxxx</permission>
    <permission>GROUP:hudson.model.Item.Cancel:ship (155bec56-8bd0-4ff0-91f0-xxxxxxxxxxx)</permission>
    <permission>USER:hudson.model.Item.Cancel:2355774d-4e69-4d33-a24c-xxxxxxxxxxx</permission>
    <permission>GROUP:hudson.model.Item.Configure:ship (155bec56-8bd0-4ff0-91f0-xxxxxxxxxxx)</permission>
    <permission>USER:hudson.model.Item.Configure:2355774d-4e69-4d33-a24c-xxxxxxxxxxx</permission>
    <permission>GROUP:hudson.model.Item.Create:ship (155bec56-8bd0-4ff0-91f0-xxxxxxxxxxx)</permission>
    <permission>USER:hudson.model.Item.Create:2355774d-4e69-4d33-a24c-xxxxxxxxxxx</permission>
    <permission>GROUP:hudson.model.Item.Delete:ship (155bec56-8bd0-4ff0-91f0-xxxxxxxxxxx)</permission>
    <permission>USER:hudson.model.Item.Delete:2355774d-4e69-4d33-a24c-xxxxxxxxxxx</permission>
    <permission>GROUP:hudson.model.Item.Move:ship (155bec56-8bd0-4ff0-91f0-xxxxxxxxxxx)</permission>
    <permission>USER:hudson.model.Item.Move:2355774d-4e69-4d33-a24c-xxxxxxxxxxx</permission>
    <permission>GROUP:hudson.model.Item.Read:authenticated</permission>
    <permission>GROUP:hudson.model.Item.Read:ship (155bec56-8bd0-4ff0-91f0-xxxxxxxxxxx)</permission>
    <permission>USER:hudson.model.Item.Read:2355774d-4e69-4d33-a24c-xxxxxxxxxxx</permission>
    <permission>USER:hudson.model.Item.Read:anonymous</permission>
    <permission>GROUP:hudson.model.Item.Workspace:ship (155bec56-8bd0-4ff0-91f0-xxxxxxxxxxx)</permission>
    <permission>USER:hudson.model.Item.Workspace:2355774d-4e69-4d33-a24c-xxxxxxxxxxx</permission>
    <permission>GROUP:hudson.model.View.Read:authenticated</permission>
    <permission>GROUP:hudson.model.View.Read:ship (155bec56-8bd0-4ff0-91f0-xxxxxxxxxxx)</permission>
    <permission>USER:hudson.model.View.Read:2355774d-4e69-4d33-a24c-xxxxxxxxxxx</permission>
    <permission>USER:hudson.model.View.Read:anonymous</permission>
  </authorizationStrategy>
  <securityRealm class="com.microsoft.jenkins.azuread.AzureSecurityRealm">
    <clientid>{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}</clientid>
    <credentialType>Secret</credentialType>
    <clientsecret>{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}</clientsecret>
    <tenant>{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}</tenant>
    <cacheduration>3600</cacheduration>
    <fromrequest>false</fromrequest>
    <environmentName>Azure</environmentName>
    <disableGraphIntegration>false</disableGraphIntegration>
    <promptAccount>false</promptAccount>
    <singleLogout>false</singleLogout>
    <domainHint></domainHint>
  </securityRealm>
  <disableRememberMe>false</disableRememberMe>
  <projectNamingStrategy class="jenkins.model.ProjectNamingStrategy$DefaultProjectNamingStrategy"/>
  <workspaceDir>${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}</workspaceDir>
  <buildsDir>${ITEM_ROOTDIR}/builds</buildsDir>
  <markupFormatter class="hudson.markup.EscapedMarkupFormatter"/>
  <jdks/>
  <viewsTabBar class="hudson.views.DefaultViewsTabBar"/>
  <myViewsTabBar class="hudson.views.DefaultMyViewsTabBar"/>
  <clouds/>
  <quietPeriod>5</quietPeriod>
  <scmCheckoutRetryCount>0</scmCheckoutRetryCount>
  <views>
    <hudson.model.AllView>
      <owner class="hudson" reference="../../.."/>
      <name>all</name>
      <filterExecutors>false</filterExecutors>
      <filterQueue>false</filterQueue>
      <properties class="hudson.model.View$PropertyList"/>
    </hudson.model.AllView>
    <listView>
      <owner class="hudson" reference="../../.."/>
      <name>  Daily Builds</name>
      <description>Builds of importance that execute every day.</description>
      <filterExecutors>false</filterExecutors>
      <filterQueue>false</filterQueue>
      <properties class="hudson.model.View$PropertyList"/>
      <jobNames>
        <comparator class="java.lang.String$CaseInsensitiveComparator"/>
        <string>v12-Development-GCS-Java-build</string>
        <string>v12-Development-GCS-Java-Nightly-build</string>
        <string>v12-Development-GCS-SQL-Nightly-build</string>
        <string>v12-Development-JASPER-REPO-Nightly-build</string>
        <string>v12-Development-Java-BI-build</string>
        <string>v12-Development-Java-build</string>
        <string>v12-Development-Java-Nightly-Build</string>
        <string>v12-Development-Revision-Info</string>
        <string>v12-Development-SQL-Nightly-build</string>
      </jobNames>
      <jobFilters/>
      <columns>
        <hudson.views.StatusColumn/>
        <hudson.views.WeatherColumn/>
        <hudson.views.JobColumn/>
        <hudson.views.LastSuccessColumn/>
        <hudson.views.LastFailureColumn/>
        <hudson.views.LastDurationColumn/>
        <hudson.views.BuildButtonColumn/>
      </columns>
      <recurse>false</recurse>
    </listView>
    <listView>
      <owner class="hudson" reference="../../.."/>
      <name> Cloud Builds</name>
      <filterExecutors>false</filterExecutors>
      <filterQueue>false</filterQueue>
      <properties class="hudson.model.View$PropertyList"/>
      <jobNames>
        <comparator class="java.lang.String$CaseInsensitiveComparator" reference="../../../listView/jobNames/comparator"/>
      </jobNames>
      <jobFilters/>
      <columns>
        <hudson.views.StatusColumn/>
        <hudson.views.WeatherColumn/>
        <hudson.views.JobColumn/>
        <hudson.views.LastSuccessColumn/>
        <hudson.views.LastFailureColumn/>
        <hudson.views.LastDurationColumn/>
        <hudson.views.BuildButtonColumn/>
      </columns>
      <includeRegex>.*-CLOUD-V12.*</includeRegex>
      <recurse>false</recurse>
    </listView>
    <listView>
      <owner class="hudson" reference="../../.."/>
      <name> Failed Builds</name>
      <filterExecutors>false</filterExecutors>
      <filterQueue>false</filterQueue>
      <properties class="hudson.model.View$PropertyList"/>
      <jobNames>
        <comparator class="java.lang.String$CaseInsensitiveComparator" reference="../../../listView/jobNames/comparator"/>
      </jobNames>
      <jobFilters>
        <hudson.views.JobStatusFilter plugin="[email protected]_4dd46909">
          <includeExcludeTypeString>includeMatched</includeExcludeTypeString>
          <unstable>false</unstable>
          <failed>true</failed>
          <aborted>false</aborted>
          <disabled>false</disabled>
          <stable>false</stable>
        </hudson.views.JobStatusFilter>
      </jobFilters>
      <columns>
        <hudson.views.StatusColumn/>
        <hudson.views.WeatherColumn/>
        <hudson.views.JobColumn/>
        <hudson.views.LastSuccessColumn/>
        <hudson.views.LastFailureColumn/>
        <hudson.views.LastDurationColumn/>
        <hudson.views.BuildButtonColumn/>
      </columns>
      <recurse>false</recurse>
    </listView>
  </views>
  <primaryView>all</primaryView>
  <slaveAgentPort>-1</slaveAgentPort>
  <label></label>
  <nodeProperties>
    <hudson.slaves.EnvironmentVariablesNodeProperty>
      <envVars serialization="custom">
        <unserializable-parents/>
        <tree-map>
          <default>
            <comparator class="java.lang.String$CaseInsensitiveComparator" reference="../../../../../../views/listView/jobNames/comparator"/>
          </default>
          <int>1</int>
          <string>MAVEN_OPTS</string>
          <string></string>
        </tree-map>
      </envVars>
    </hudson.slaves.EnvironmentVariablesNodeProperty>
  </nodeProperties>
  <globalNodeProperties/>
  <nodeRenameMigrationNeeded>false</nodeRenameMigrationNeeded>

let me know

@timja
Copy link
Member

timja commented Feb 13, 2025

Which version of Jenkins and the Azure AD plugin are you using?

@csrvsk
Copy link
Author

csrvsk commented Feb 13, 2025

Jenkins Version: 2.482
Azure AD Plugin Version: 551.v26fb_2998b_61f

I also tried on other server with these versions, it is also giving me the same issue
Jenkins Version: 2.492.1 - latest version
Azure AD Plugin Version: 552.va_63b_3140c917 - this is also latest version.

Since it is not working, I also manually added the plugin version - 531.v13107da_f2635, which is working fine on other version.
But no luck on this instance.

I have 3 instances on which AzureAD plugin is troubling to lookup users/groups to add and assign permissions.
NOTE: Security Authentication part is fine on all the instances. Authorization Matrix - lookup is the main issue.

Below all combinations are from other jenkins instances we use, are working fine

Image

@csrvsk
Copy link
Author

csrvsk commented Feb 14, 2025

I also found jenkins version and it's compatible plugin versions page here - https://updates.jenkins.io/download/plugins/azure-ad/

Based on this, it is evident that I haven't installed any incompatible version for sure.

Image

@timja timja mentioned this issue Feb 14, 2025
6 tasks
@timja
Copy link
Member

timja commented Feb 14, 2025

Could you try this debug build:
https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/azure-ad/554.vfe3e8f5d90ce/azure-ad-554.vfe3e8f5d90ce.hpi

Install the plugin from the advanced page, restart

On the security page:
Search the page for Graph integration status and take a screenshot uploading it here.

@csrvsk
Copy link
Author

csrvsk commented Feb 14, 2025

What is the minimum Jenkins version required for the latest patch of the plugin you have shared?

@timja
Copy link
Member

timja commented Feb 14, 2025

2.479.1

@csrvsk
Copy link
Author

csrvsk commented Feb 14, 2025

So, for testing I have jenkins instance with the version of 2.452.1.
I don't want to create more mess in the Prod instances that this plugin already gave us. Could you please provide a DEBUG version of the plugin compatible with that version.

To test it on the prod instances, we need to schedule the downtime and notify users, which would delay this testing.

One more thing about the changing plugin versions like (Downgrade/Upgrade), since downgrade option is not provided by Jenkins through UI, we would manually download the plugin**.hpi** file to the plugin directory and restart the server right?

And then, that plugin also has requirement of some other dependent plugins, which we would have to search for them manually to find out which version of that plugin has the compatibility with our Jenkins version. In this case, what happens if we just download the DEBUG version you are suggesting? what about the dependency plugin versions?

And also let me know, since there is not much information found on Jenkins logs about the issue we are currently dealing with, is there a way to check more details of this issue on Azure side?

Please advice.

@timja
Copy link
Member

timja commented Feb 14, 2025

Use this version instead: https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/azure-ad/557.v5eed7a_c68693/azure-ad-557.v5eed7a_c68693.hpi

Is it possible to test on a version that isn't production?

@csrvsk
Copy link
Author

csrvsk commented Feb 14, 2025

azure-ad/557.v5eed7a_c68693/azure-ad-557.v5eed7a_c68693.hpi --- Is this compatible with Jenkins version 2.452.1?

As I already mentioned, for testing I have jenkins instance with the version of 2.452.1.

And what about the dependency plugins and compatible versions?

@timja
Copy link
Member

timja commented Feb 14, 2025

yes it is, dependencies will be compatible as long as you are up to date.

@csrvsk
Copy link
Author

csrvsk commented Feb 14, 2025

I mean is it compatible with the Jenkins version - 2.452.1?

What do you mean up to date? I did not understand that part

We have a jenkins version - 2.452.1
And azure-ad plugin version - 557.v5eed7a_c68693 - is it compatible? - I want to double check because this version look like the latest version. Not sure about the requirement of the Jenkins version.

And this plugin dependencies - are they compatible with Jenkins version 2.452.1?
If not, could you please provide the compatible version of dependency plugins.

@timja
Copy link
Member

timja commented Feb 14, 2025

Yes it will work. It’s the latest version with some changes backed out so it works on your Jenkins

@csrvsk
Copy link
Author

csrvsk commented Feb 14, 2025

Thank you for confirming that, I will check and let you know soon.

@csrvsk
Copy link
Author

csrvsk commented Feb 14, 2025

Hi,

Here is the screenshots,

Image

Image

Image

Date: Fri Feb 14 13:48:35 EST 2025
Jenkins Version: 2.452.1
azure-ad Version: Plugin-Version: 557.v5eed7a_c68693
azure-sdk Version: Plugin-Version: 174.va_89c1df897d2
caffeine-api Version: Plugin-Version: 3.1.8-133.v17b_1ff2e0599
commons-lang3-api Version: Plugin-Version: 3.17.0-84.vb_b_938040b_078
gson-api Version: Plugin-Version: 2.11.0-41.v019fcf6125dc
okhttp-api Version: Plugin-Version: 4.11.0-172.vda_da_1feeb_c6e
mailer Version: Plugin-Version: 488.v0c9639c1a_eb_3
matrix-auth Version: Plugin-Version: 3.1
[oracle@branchbuilds plugins]$

please verify and let me know. Just so you know, no problem in authentication part.

@timja
Copy link
Member

timja commented Feb 14, 2025

In the above screenshot you only have the Add button which shows the integration enabled which is what I expected based on the config (although not the same as in your previous screenshot).

The reason for your last screenshot not showing results should either be in your browser console or the Jenkins server logs

@csrvsk
Copy link
Author

csrvsk commented Feb 15, 2025

Yes, you are right about that add button. but it is not useful atal as i am unable to click and add any user/groups.

The names which were added at the time of initial configuration of the plugin. That’s it if we want to add more user/groups after that it is not able to search and also not allowing us to add manually thru UI.

You can also see that it is showing a pop-up saying “we didn’t find any matches.”

I tried browsers after clearing browser cache as well. Even i tried in an incognito window as well.

But it is working very fine for other jenkins instances. Why it is not working for one instance and not other is not clear.

Please advice how to investigate further.

@timja
Copy link
Member

timja commented Feb 15, 2025

As I said before please check this:

The reason for your last screenshot not showing results should either be in your browser console or the Jenkins server logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants