Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Getting photo from Azure Active Directory to Power BI/Query

Hi!

 

I am trying to get data from Azure Active Directory to Power BI Desktop. I though that would be easy through the Active Directory Connector. But that wasn't easy. After spending to much time on that I come over using Azure AD Graph in stead. That seems to work and the graph explorer was helpful. 

https://graph.windows.net/{mytenant.Onmicrosoft.com}/users?api-version=1.6 gave me all users data. See code below. Take note of the field [email protected], it is a part of link to the picture. Adding https://graph.windows.net/{mytenant.Onmicrosoft.com}/ before this text we got a correct address to the picture. Then I though I could create this code below to get the picture perhaps as Base64 binary code, and hopefully could add this field in a chiclet slicer component or something to show the picture. The code below gave me an error

 

DataFormat.Error: We found extra characters at the end of JSON input.
Details:
Value=
Position=0

 

Perhaps it is a better way to get photos on power bi service/office365, but if any of you have a clue what is wrong and how to correct this I would be grateful

 

Regards Geir

 

 

let

    Source = Json.Document(Web.Contents("https://graph.windows.net/mytenant.OnMicrosoft.com/directoryObjects/af894aa1-9fad-4400-818b-580c7258a115/Microsoft.DirectoryServices.User/thumbnailPhoto?api-version=1.6")),
       value = Source[value],
    ConvertedtoTable = Table.FromList(value, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
 
    in

    ConvertedtoTable

 

1 Reply

  • dax's avatar
    dax
    Icon for Community Support rankCommunity Support

    Hi geirf,

    If you want to add image to powerbi  from AAD, you could try to refer to Add Photos to Power BI from Active Directory for details.

    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.