question

SPK545-5672 avatar image
2 Votes"
SPK545-5672 asked PramodValavala-MSFT published

Azure resource graph connection with Logic apps

hello,

Is there any way to connect Azure resource graph explorer with Logic apps, I'm trying to execute the below process in the automation process

1) I need to run a query from the Azure Resource graph and export those results on daily basis to the Azure database

2) I'm currently running query (KQL to know about resources in Azure) and exporting into CSV file, sending them manually

Please provide your thoughts

TIA

azure-logic-apps
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ChaitanyaNaykodiMSFT-9638 avatar image
0 Votes"
ChaitanyaNaykodiMSFT-9638 answered MatteoDurini-2726 commented

Hello @SPK545-5672, apologies for the delay. My suggestion to automate the process above will be to perform queries using REST endpoint of Azure resource graph as using logic app you can call a HTTP endpoint using Azure Logic App.
For the first process you can have a Reoccurrence trigger for your logic app and then perform the HTTP action as mentioned above to run the query and use the Azure SQL database connector for Logic app to insert the results.
For the second process you can run the query as mentioned above and then use data operation functionality of the Logic App to write a CSV table and use any Email connectors Like Gmail or Outlook to send the data out.

Please let me know if there are any concerns. Thank you!


· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

hello@ChaitanyaNaykodiMSFT-9638,

I gone through the documentation and tried to do that but not sure how i can connect to the Azure resource graph execute the below query by using logic apps as shown in screesnhot



Can you please provide me a screenshot of which connectors I should use in the flow?

I've used the below URI to test the API connection, getting "401 unauthorized error "

https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2020-04-01-preview
48750-image.png


0 Votes 0 ·
image.png (21.6 KiB)

Hello @SPK545-5672, apologies for missing this out, I think my name did not get tagged properly so I missed out on the notification. Based on your new post, did you find the resolution for the issue faced above?


0 Votes 0 ·

Hi, you are missing the Authentication part in the POST HTTP Call. As you can see in my screenshot, i'm doing a first HTTP Call to retrieve the Bearer token that i'm using in the second call: I prefer that approach because in the same logic app i'm doing several queries to the Azure APIs and i can easily reuse the same token

96581-2021-05-14-00-02-44.png


0 Votes 0 ·

Hi @ChaitanyaNaykodiMSFT-9638 did you resolve this? Needing to do the same thing finding it difficult. Thanks, John

0 Votes 0 ·

Hi, you are missing the Authentication part in the POST HTTP Call. As you can see in my screenshot, i'm doing a first HTTP Call to retrieve the Bearer token that i'm using in the second call: I prefer that approach because in the same logic app i'm doing several queries to the Azure APIs and i can easily reuse the same token

96523-2021-05-14-00-02-44.png


0 Votes 0 ·
PreranaPrajapat-6938 avatar image
0 Votes"
PreranaPrajapat-6938 answered

@ChaitanyaNaykodiMSFT-9638 @SPK545-5672 @johnjoyner were you able to automate this process? I am facing similar challenge

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.