Forum Discussion
Running Graph API queries
- 7 years ago
I would also prefer that this would be easier.
Currently you have to:
1) use a custom connector and
2) create an app in the azure portal that handles the authentication for the connector
With my connector, I'm able to see the license details. Unfortunately I cannot add the permissions for the subcriptions to the app, as that's a preview feature currently.
Please let me know if you want to proceed just for the license details and I can provide further help on how to implement the connector. Am I getting it right that you have registered you app successfully already?
- 7 years ago
Hi alietzau ,
great - thanks for the tip - that worked for me as well! Actually, didn't have to clear my other permissions fortunately.
You can try my connector. The enclosed zip includes all files necessary. You have to perform the following steps:
1) Unzip it
2) edit client_id: replace content by the client id of your app
3) edit client_secret: replace content by the client secret of you app
4) zip all files back and rename the zip to "MyGraphB.mez"
5) Copy that file into your Power BI Desktop-folder: C:\Users\<YourUserName>\Documents\Power BI Desktop\Custom Connectors
Now, when you type in "mygr" for example, these 2 items should show up:
Choose the latter ("MyGraphB2.WebContents") and paste the URL of your choice.
If interested, I've described the Web.Contents-addition here: https://www.thebiccountant.com/2019/04/17/graph-api-custom-connector-power-bi/
ImkeF I was just able to get the queries that I listed to work, using the permission of "Directory.Read.All" and making sure that no other permissions were added to my App. I'm listing the results of the queries below for reference.
- https://graph.microsoft.com/v1.0/subscribedSkus
- Retreieves the license count, usage, and open license count for our tenant.
- https://graph.microsoft.com/v1.0/users/<UPN>/licenseDetails
- Retrieves the licenses that a user has. (like their E3 or PowerBI Pro)
Now all I need to do is build the powerquery to run the Graph API query. I took another look at the guide that mention in my original post and it's still hard to follow. Do you have a good guide to building this custom connector? I think this is the final road block stoping me from using the data.
Hi alietzau ,
great - thanks for the tip - that worked for me as well! Actually, didn't have to clear my other permissions fortunately.
You can try my connector. The enclosed zip includes all files necessary. You have to perform the following steps:
1) Unzip it
2) edit client_id: replace content by the client id of your app
3) edit client_secret: replace content by the client secret of you app
4) zip all files back and rename the zip to "MyGraphB.mez"
5) Copy that file into your Power BI Desktop-folder: C:\Users\<YourUserName>\Documents\Power BI Desktop\Custom Connectors
Now, when you type in "mygr" for example, these 2 items should show up:
Choose the latter ("MyGraphB2.WebContents") and paste the URL of your choice.
If interested, I've described the Web.Contents-addition here: https://www.thebiccountant.com/2019/04/17/graph-api-custom-connector-power-bi/
- alietzau7 years agoFrequent Visitor
ImkeF Thank you! I think this gets me super close but I'm still hitting a roadblock. I've updated the client_id and secret file and packaged it just like you said. However, when I try to use the connector to run my query, I get this error.
Do you know why it's not finding the client_id? I'm sure that the name matches the file in the .mez file. I'm not familiar enough with custom connectors to determine why it would be having this issue.
Also, thank you for your help with all of this.
- ImkeF7 years ago
Community Champion
The error message means that the file is not found, so the actual content hasn't been checked yet.
Please check that when saving the file, no extension has been added to the file.
If nothing else helps, you can only integrate the client_id as a direct variable in the connector code instead of referencing it from an external file.
- alietzau7 years agoFrequent Visitor
ImkeF That work! Thank you so much! This is great, I'm glad that I'm able to start working on the report now that I can bring the data in. It's a shame that I can't have the queries update in PowerBI Pro, but with how useful this information is, I'll take that hit.
Again, thank you so much for your help.