cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nolock
New Member

Audience in an HTTP request via Active Directory OAuth

Hi,

I'd like to automate some tasks in Power BI Service. Unfortunately, there is only a simple connector for Power BI. It means I have to write my own custom connector or create some HTTP request by myself (https://docs.microsoft.com/en-us/rest/api/power-bi/). That's ok for me.

But the problem is: I've registered an app in Azure and got client ID and client secret. But if I want to create an HTTP request with Active Directory OAuth, there is a field I don't understand: audience. I wasn't able to find out what I should write in. Does anybody have an idea what the field is for and what should be there?

Thank you for every hint.

 

audience.png

12 REPLIES 12
v-litu-msft
Community Support
Community Support

Hi @Nolock,

 

You can have a try with:

https://graph.microsoft.com

There has a blog about Graph call, maybe it could help you something:

https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/The-Sweetest-Graph-Call-You-ve-Eve...

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @v-litu-msft,

thank you very much for your answer. Unfortunately, it didn't work 😞

In some resource they use a URI, sometimes a GUID like here. The definition from the link says: "The GUID for the target resource that you want to access, which is the client ID from the application identity for your web app or API app."

I've tried everything possible, nothing works 😞

Amin0
Regular Visitor

 
Amino0
Frequent Visitor

In case someone is still stuck with this error. The Audience should be one of the below

'https://service.flow.microsoft.com/'

'https://management.core.windows.net/'

'https://management.azure.com/'

'https://service.powerapps.com/'

'https://service.kratosapps.com/'

'637fcc9f-4a9b-4aaa-8713-a2a3cfda1505'.

 

The Audience is the API which your custom authentication App has permissions on. To get this URL, navigate to Azure AD --> App Registration, then select your custom authentication App, and click on API Permissions. Hereafter, select API / Permissions name which should pop up the permission details along with the used API. For example, https://service.flow.microsoft.com/Approvals.Manage.All . In this case, the Audience is https://service.flow.microsoft.com/  

Amino0
Frequent Visitor

In case someone is still stuck with this error. The Audience should be one of the below

 

 

'https://service.flow.microsoft.com/','https://management.core.windows.net/','https://management.azure.com/','https://service.powerapps.com/','https://service.kratosapps.com/','637fcc9f-4a9b-4aaa-8713-a2a3cfda1505'

 

The Audience is the API which your custom authentication App has permissions on. To get this URL, navigate to Azure AD --> App Registration, then select your custom authentication App, and click on API Permissions. Hereafter, select API / Permissions name which should pop up the permission details along with the used API. For example, https://service.flow.microsoft.com/Approvals.Manage.All. In this case, the Audience is https://service.flow.microsoft.com/ 

tony_hernandez
Frequent Visitor

Updating this post. Easiest way to find your audience in 2021 is to go to:

AAD > App Registration > Select App > API Permissions > Click the Top level item of a permission (i.e. Microsoft Graph) > When the Library opens you should see the an HTTPS address below the Name label. This is your API audience.

tony_hernandez_0-1622040731203.png

 

 

 

seadude
Memorable Member
Memorable Member

Hm. I'm not able to get this to work: 

- Registered app in AAD:

seadude_0-1628609155689.png

- Setup HTTP action accordingly

seadude_1-1628609194311.png

 

Results:

seadude_2-1628609236412.png

 

Any ideas on what I'm missing?

I have exactly same issue-Http request failed as there is an error getting AD OAuth token: 'AADSTS500011: The resource principal named "https://service.flow.microsoft.com" was not found in the tenant named swiftinit. This can happen if the 

wab
Frequent Visitor

Did you managed to find a solutions?

IHPROLAN
Frequent Visitor

Hello, I am also having trouble using the OAuth. I get the same error. Is there any solution on that?

WillPage
Solution Sage
Solution Sage

I came across this topic while searching for the answer to what to put in the Audience field in the Authentication object. I found this works for the Power BI API. Note there is no trailing / character, which exists in the API permissions in the App Registration:

 

 

wab
Frequent Visitor

The solution is to make sure you added the api that you created in Azure to security group. That group also need to be allowed to use service principals and need to be added to environment as Member. 

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,727)