Travel free
Travel free

Reputation: 11

Azure Logic app - how to use it beyond its subscription

I have created a Logic app (consumption) to query the Microsoft Resource graph for some open alerts, using API. The app is working fine but only listing the result within that subscription . I need the result from all subscriptions- please help me to understand how can i change my logic app to change the scope without deploying it in all the subscriptions?

Used the connectors List all subscriptions from ARM with no luck.

being a novice , please redirect me to the correct way of doing

Expecting the result from all subscriptions than the only one ,where the logic app is deployed.

Upvotes: 1

Views: 542

Answers (2)

Daisy
Daisy

Reputation: 328

give the logic app reader access to other subscriptions

Upvotes: 0

vijaya
vijaya

Reputation: 1721

You can use rest api to list all subscriptions and using another rest api you can query open alerts in logic app. Before that you need to set AAD app for authentication and getting bearer token. Refer this document for getting token.

  • Created logic app as shown below, enter image description here
  • Here I have used request trigger in logic app. Next taken http action to get token using AAD app.

enter image description here

  • Taken another http action and method as Get with Url "https://management.azure.com/subscriptions?api-version=2019-06-01". Passing token obtained from previous step in Header as shown below, enter image description here

    This will provide list of all subscriptions.

  • Using for each loop to iterated over each subscription id and get alerts for that particular subscription using url "https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts?api-version=2020-10-01" enter image description here

    This will provide alerts for each subscription.

  • Ran logic app and able to get alerts for each subscription, enter image description here

HTTP output:

enter image description here enter image description here

Output of HTTP2:

enter image description here

Reference links SO, MS document.

Upvotes: 0

Related Questions