0

This is what i wantI want Diagnostics Status of particular resource in azure portal with azure rest API. Status is like: Enabled/Disabled

I have gone through most of the Rest API related to Diagnostics settings but in that API we need to pass the workflow, but i don't have workflow. I want Diagnostics status of particular resource. It's enabled or disabled.

https://learn.microsoft.com/en-us/rest/api/monitor/diagnosticsettings/list, This is API which i am referring

1 Answers1

1

You could not directly get the status like enable or disable with the link you provided. Because the diagnostics status is under the resource group or under Diagnostics settings service. And it seems that there is no signal rest api to get the Diagnostics settings.

Here is my workaround:

The different between enable and disable diagnostic settings is whether their response body have content.

So, when using rest api, the response body is null means status is disable, otherwise it is enable. And if you use rest api C#, you could get the response body like below:

var response = client.GetAsync(requestURl).Result.Content.ReadAsStringAsync().Result;

Hope it helps you.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30
  • Under my diagnostics settings, there are four resources with the resource type SQL DB, Network Interface and Public IP address (resource type). I want these four resources with the information (Name, Resource Type, Resource Group and Diagnostics status). So, for this i am not able to find the Rest API. Is there any way to get this info. – Shubham Tokalwad Oct 21 '19 at 13:34
  • I have added image on my post please go through it to get what i want exactly, thanks. Awaiting for your response – Shubham Tokalwad Oct 21 '19 at 13:40
  • No, there is no signal rest api to get what you want. If you have any feedback, create a new issue in the [MicrosoftDocs/feedback repo on GitHub](https://github.com/MicrosoftDocs/feedback/issues). – Joey Cai Oct 22 '19 at 02:52
  • Thanks Joey, I will create issue, If there is way to get this data from multiple rest API that will be ok. If you any idea related to this please let us know – Shubham Tokalwad Oct 22 '19 at 04:59
  • Yes, sure Awaiting for your response – Shubham Tokalwad Oct 22 '19 at 06:03
  • No. I search long time, and could find nothing. Sorry. – Joey Cai Oct 23 '19 at 08:56
  • I still think there no rest api to achieve it. – Joey Cai Oct 23 '19 at 09:16
  • Actually, i have posted this question on azure support. Let's wait for their response. – Shubham Tokalwad Oct 24 '19 at 04:59
  • If they also don't have any answer then i'll definitely accept it as a answer – Shubham Tokalwad Oct 24 '19 at 05:02