question

SeanKilleen avatar image
0 Votes"
SeanKilleen asked ·

Does the Azure AD B2C Graph endpoint support UTF-8 charset for uploading policies?

I have a custom policy XML document that contains characters that need UTF-8 to be rendered correctly (A country name of Curaçao)

When I manually run my CI scripts which use UTF-8 and upload the policy to Azure B2C's UI, I see the characters as expected.

However, despite reading the file using the UTF-8 encoding, when I call the graph.microsoft.com/beta/trustframework/policies/ endpoint for my PUT request, the resulting policy appears to not be rendered using UTF-8.

I have attempted the following for my content headers

  • $headers.Add("Content-Type", 'application/xml') -- the original, where I first saw the problem

  • $headers.Add("Content-Type", 'application/xml; charset=UTF-8') -- no change

  • $headers.Add("Content-Type", 'application/xml; charset="UTF-8"') -- 500 error from server

  • $headers.Add("Content-Type", 'application/xml; charset=utf-8') -- successfully completes, but no change; see the same issue

Any thoughts? I'm sure it must be something I'm missing.

The full powershell excerpt of what I'm doing:

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
    $headers.Add("Content-Type", 'application/xml; charset=utf-8')
    $headers.Add("Authorization", 'Bearer ' + $token)

    $graphuri = 'https://graph.microsoft.com/beta/trustframework/policies/' + $PolicyId + '/$value'
    $policycontent = Get-Content $PathToFile -Encoding UTF8
    $response = Invoke-RestMethod -Uri $graphuri -Method Put -Body $policycontent -Headers $headers

azure-ad-b2c
· 2
10 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @SeanKilleen,

Thanks for reaching out.

I am looking at this, will get back to you with my findings. Thanks.

0 Votes 0 ·

0 Answers