Bug 48641 - Discover and connect existing Office365 users with ucs users
Discover and connect existing Office365 users with ucs users
Status: NEEDMOREINFO
Product: UCS
Classification: Unclassified
Component: Office 365
UCS 5.0
amd64 Linux
: P5 normal (vote)
: ---
Assigned To: Mail maintainers
Mail maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-02-11 10:09 CET by Erik Damrose
Modified: 2024-01-04 08:13 CET (History)
7 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 5: Blocking further progress on the daily work
User Pain: 0.343
Enterprise Customer affected?: Yes
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2020110421000501, 2023012721000311
Bug group (optional): SAML
Max CVSS v3 score:


Attachments
script to connect existing UCS users to existing Azure AD users (5.51 KB, text/x-python)
2019-10-25 16:36 CEST, Erik Damrose
Details
script to connect existing UCS users to existing Azure AD users v2 (6.43 KB, text/x-python)
2021-02-22 19:06 CET, Erik Damrose
Details
script to connect existing UCS users to existing Azure AD users v3 (7.62 KB, text/x-python)
2022-12-16 18:07 CET, Johannes Lohmer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Damrose univentionstaff 2019-02-11 10:09:34 CET
+++ This bug was initially created as a clone of Bug #44749 +++

Almost all customers that use the Office365 connector have asked for the possibility to connect existing Office365 users to existing ucs users.

We described how to do the process manually here: https://help.univention.com/t/ucs-office365-issue/7209
Comment 1 Erik Damrose univentionstaff 2019-10-25 16:36:00 CEST
Created attachment 10219 [details]
script to connect existing UCS users to existing Azure AD users
Comment 3 Erik Damrose univentionstaff 2021-02-22 19:06:15 CET
Created attachment 10628 [details]
script to connect existing UCS users to existing Azure AD users v2

New version of the script, support for multiple ad connections added.

Example call: There is a testuser uid=test03, and an Azure
user aaduser_03@somedomain.onmicrosoft.com.
test03 should be connected, and the ad connection in UCS is the default  'defaultADConnection'.
The user has no mailPrimaryAddress set in UCS, and is not activated for O365. We have to configure a mailadress, and choose to set the uid as the localpart, and use a maildomain that is configured in UCS, in this case 'mydomain.intranet'

./o365_connect_azure_to_ucs_user
-p aaduser_03@univentiontestgmbh.onmicrosoft.com
-u test03
--set_mail --maildomain mydomain.intranet
--mail_localpart_from_uid -a -c defaultADConnection

This is the default run, to really modify the user add --modify to the call.
Disclaimer: Test this with testusers first, and double check every connected user. The modification will set the immutableID in the Azure AD, the script can only be called once for every user. To reset the immutableID in Azure, powershell on Windows can be used.
Comment 4 Ingo Steuwer univentionstaff 2021-05-14 16:51:00 CEST
should be still relevant for UCS 4.4
Comment 5 Cornelius Hald 2022-11-04 13:58:04 CET
That script does not work anymore with the recent version of the MS365 connector. Is there an updated version?

I'm getting the following error with:
- MS365 Connector 4.4
- UCS 4.9

$ ./o365_sync_existing_users 
Traceback (most recent call last):
  File "./o365_sync_existing_users", line 34, in <module>
    from univention.office365.azure_handler import AzureHandler
ImportError: No module named azure_handler
Comment 6 Johannes Lohmer univentionstaff 2022-12-16 18:07:30 CET
Created attachment 11019 [details]
script to connect existing UCS users to existing Azure AD users v3
Comment 7 Johannes Lohmer univentionstaff 2022-12-19 11:52:01 CET
Caveats:

Hashbang needs to be different, depending on the UCS version 5.0 -> python3, 4.4 -> python2

The script is 90% idempotent: It can be executed many times for the same User. But! A successful script-run may change the UserPrincipalName in Azure which will break subsequest script-runs.


How to test:
Create UDM user: 
> udm users/user create --set username=blumendi --set lastname=blumendi --set password=univention --position cn=users,dc=test,dc=intranet --set mailPrimaryAddress=blumendi@test.intranet

Create Azure user in Azure Portal (azuretestdomain)

try to connect the users:

Minimal Version: 
> python3 connect_existing_users.py -p "blumendi@alphadistrict.onmicrosoft.com" -u "blumendi" -c azuretestdomain -m user is not activated
Add -a to activate user
Add --set_mail --maildomain test.intranet --mail_localpart_from_uid to sync Mail aswell
Look in UDM if the stuff was written into LDAP

Look in Azure if the onPremiseImmutableId was synced

Modify UDM user and see if it syncs to Azure: 
> udm users/user modify --dn uid=blumendi,cn=users,dc=test,dc=intranet --set lastname=blumendi333 --set firstname=blumendi444
Comment 8 Erik Damrose univentionstaff 2023-01-18 16:01:37 CET
Resetting bug state. If the bug has any state in the flag 'Resolution', it is not included in the bugzilla default search result.
As this script is not part of the product at the moment, this bug should be easy to find.
Comment 9 Dirk Ahrnke univentionstaff 2024-01-03 18:48:50 CET
A partner requested the solution for this feature while preparing for a partial migration of users from an existing UCS@School instance to a new one.
Comment 10 Daniel Tröder univentionstaff 2024-01-04 08:13:59 CET
Why hasn't this been made part of the product yet? The bug is 5 years old. The original bug is even 7 years old!
The opening clearly says that almost every customer using the app needs this.

I have made this a "bug" instead of a "feature request," so it gets better prioritized.
The feature (a script) exists. It just hasn't been packaged properly. IMHO, that's a bug.

The script to do this has existed for 5 years now.
All that's left to do is add it to the distribution and write a test + Jenkins for it to support it.