PeterKaagman has asked for the wisdom of the Perl Monks concerning the following question:
Hi there,
One of the recurring things I need to do each year is create new students in our AD domain. This year it's a bit different because there will be no AD Domain anymore, just an Azure AD. So our regular tool do not work anymore and I thought I write up my own using Perl and MS Graph to create the users.
Creating the user based upon our school information system turned out to be not verry hard... just one snag: parents keep coming up with beautifull names containing all sorts characters which don't fit in to ASCII. I know, welcome to the 21st century. You'll have to use unicode I guess. Been avoiding that for a long time. Tried to read up on it recently, but is confuses the hell out of me
Would very much welcome some practical hints on how to go about getting decent names in our AAD.
This is kinda what I would like to do:
For testing purposes I've put some users in an HoH, one of them looking like:
'b232124@ict-atlascollege.nl' => { 'naam' => 'Kühne, Jan', 'v_naam' => 'Jan', 'tv' => '', 'a_naam' => 'Kühne', 'studie' => '2V6', 'stam_nr' => '231224', 'klas' => '', 'locatie' => 'Copernicus SG' }
This resembles the data I would get from the school information system.
To make the HTTP POST I make this into an payload like this:
# payload maken my $fullName = $magisterLLN->{$upn}->{'v_naam'}; $fullName .= " $magisterLLN->{$upn}->{'tv'}" if ($magisterLLN->{$upn}->{'tv'}); $fullName .= " $magisterLLN->{$upn}->{'a_naam'}"; my $payload = { "accountEnabled" => \1, "displayName" => decode('UTF-8',$fullName), "mailNickname" => "b".$magisterLLN->{$upn}->{'stam_nr'}, "userPrincipalName" => "b".$magisterLLN->{$upn}->{'stam_nr'}.'@ict-atlascollege.nl', "passwordProfile" => { "forceChangePasswordNextSignIn" => \1, "password" => "zeer_geheim_2024" }, };
Next I use LWP to POST the json encoded payload to graph.
In this example I decode the fullname using UTF-8 which to my surprise gave me the best result yet, but I still end up with something like "K?hne" in Azure
Tried encoding and decoding on different stages of the process, but nothing seems to be doing the right thing.
Would appreciate you help a lot.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Strings with umlauts and such
by hippo (Archbishop) on Aug 13, 2024 at 10:26 UTC | |
by PeterKaagman (Beadle) on Aug 13, 2024 at 10:49 UTC | |
by hippo (Archbishop) on Aug 13, 2024 at 11:12 UTC | |
Re: Strings with umlauts and such
by NERDVANA (Priest) on Aug 15, 2024 at 04:50 UTC | |
Re: Strings with umlauts and such
by PeterKaagman (Beadle) on Aug 22, 2024 at 11:14 UTC | |
Re: Strings with umlauts and such
by cavac (Prior) on Aug 14, 2024 at 08:15 UTC | |
Re: Strings with umlauts and such
by PeterKaagman (Beadle) on Aug 13, 2024 at 10:31 UTC |