Reputation: 1
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
Upvotes: 0
Views: 443
Reputation: 20127
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.
Upvotes: 1