Start/Stop Stream Analytics Job REST API Authorisation error

Umair Akhtar 41 Reputation points
2023-01-11T13:20:38.51+00:00

Hi,

So I am using a Power Automate flow which send REST API HTTP post request to start/stop the stream analytics.

In first step, I am fetching the bearer token sucessfully for which I have created an app and did app registeration in azure active directory. In Api permission, I have added azure service management (
user_impersonation) also microsoft graph was already had permission. Now I got client id and secret for this app which I have saved in Keyvault which i am using in flows.

In Expose an API, i have added name of the stream analytics as scope and gave admin & user rights consent.

In Stream analytics, http post is: https://management.azure.com/subscriptions/xxxfd2xx-xxxx-xxxx-xxxx-668dbxxxxxx3xx/resourcegroups/TEUXXXXT/providers/Microsoft.StreamAnalytics/streamingjobs/asa-xxx-dev/start?api-version=2020-03-01

where it takes authorization from bearer token which correct and content type is application/json while body is { "outputStartMode": "JobStartTime" }.

Now, the proces successfully fetch bearer token however, in stream analytics rest api post request it give this error

'The client 'xxxx4f8x-x2xx-x8xx-xx5x-xxx771a05xxx' with object id 'xxxx4f8x-x2xx-x8xx-xx5x-xxx771a05xxx' does not have authorization to perform action 'Microsoft.StreamAnalytics/streamingjobs/start/action' over scope '/subscriptions/xxxfd2xx-xxxx-xxxx-xxxx-68dbxxxxxx3xx/resourcegroups/TEUXXXXT/providers/Microsoft.StreamAnalytics/streamingjobs/asa-xxx-dev' or the scope is invalid. If access was recently granted, please refresh your credentials.'

How can I resolve this issue?

Thank you

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,115 questions
Azure Stream Analytics
Azure Stream Analytics
An Azure real-time analytics service designed for mission-critical workloads.
330 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,465 questions
0 comments No comments
{count} votes

Accepted answer
  1. ShaikMaheer-MSFT 37,896 Reputation points Microsoft Employee
    2023-01-12T09:11:44.8033333+00:00

    Hi Umair Akhtar,

    Thank you for posting query in Microsoft Q&A Platform.

    From error message it seems on stream analytics resource for your app registration, you have not given proper roles or permissions to do the job. Kindly try giving contributor role to your app registration or service principle and then make API call.

    Hope this helps. Please let me know how it goes.


    Please consider hitting Accept Answer button. Accepted answers help community as well.


0 additional answers

Sort by: Most helpful