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.


In reply to Strings with umlauts and such by PeterKaagman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.