Gets the active diagnostic settings for the specified resource.
GET https://management.azure.com/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}?api-version=2021-05-01-preview
URI Parameters
Name |
In |
Required |
Type |
Description |
name
|
path |
True
|
string
|
The name of the diagnostic setting.
|
resourceUri
|
path |
True
|
string
|
The identifier of the resource.
|
api-version
|
query |
True
|
string
|
The API version to use for this operation.
|
Responses
Name |
Type |
Description |
200 OK
|
DiagnosticSettingsResource
|
Successful request to get more information about diagnostic setting
|
Other Status Codes
|
ErrorResponse
|
Error response describing why the operation failed.
|
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
Gets the diagnostic setting
Sample request
GET https://management.azure.com/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/Microsoft.Insights/diagnosticSettings/mysetting?api-version=2021-05-01-preview
/**
* Samples for DiagnosticSettingsOperation Get.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/
* getDiagnosticSetting.json
*/
/**
* Sample code: Gets the diagnostic setting.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getsTheDiagnosticSetting(com.azure.resourcemanager.AzureResourceManager azure) {
azure.diagnosticSettings().manager().serviceClient().getDiagnosticSettingsOperations().getWithResponse(
"subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6",
"mysetting", com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmonitor_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSetting.json
func ExampleDiagnosticSettingsClient_Get_getsTheDiagnosticSetting() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmonitor.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewDiagnosticSettingsClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{
// Name: to.Ptr("mysetting"),
// Type: to.Ptr("Microsoft.Insights/diagnosticSettings"),
// ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"),
// Properties: &armmonitor.DiagnosticSettings{
// EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"),
// Logs: []*armmonitor.LogSettings{
// {
// CategoryGroup: to.Ptr("allLogs"),
// Enabled: to.Ptr(true),
// RetentionPolicy: &armmonitor.RetentionPolicy{
// Days: to.Ptr[int32](0),
// Enabled: to.Ptr(false),
// },
// }},
// MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"),
// Metrics: []*armmonitor.MetricSettings{
// {
// Category: to.Ptr("WorkflowMetrics"),
// Enabled: to.Ptr(true),
// RetentionPolicy: &armmonitor.RetentionPolicy{
// Days: to.Ptr[int32](0),
// Enabled: to.Ptr(false),
// },
// }},
// StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"),
// WorkspaceID: to.Ptr(""),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MonitorClient } = require("@azure/arm-monitor");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets the active diagnostic settings for the specified resource.
*
* @summary Gets the active diagnostic settings for the specified resource.
* x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSetting.json
*/
async function getsTheDiagnosticSetting() {
const resourceUri =
"subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6";
const name = "mysetting";
const credential = new DefaultAzureCredential();
const client = new MonitorClient(credential);
const result = await client.diagnosticSettings.get(resourceUri, name);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Monitor;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSetting.json
// this example is just showing the usage of "DiagnosticSettings_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this DiagnosticSettingResource created on azure
// for more information of creating DiagnosticSettingResource, please refer to the document of DiagnosticSettingResource
string resourceUri = "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6";
string name = "mysetting";
ResourceIdentifier diagnosticSettingResourceId = DiagnosticSettingResource.CreateResourceIdentifier(resourceUri, name);
DiagnosticSettingResource diagnosticSetting = client.GetDiagnosticSettingResource(diagnosticSettingResourceId);
// invoke the operation
DiagnosticSettingResource result = await diagnosticSetting.GetAsync();
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
DiagnosticSettingData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting",
"type": "Microsoft.Insights/diagnosticSettings",
"name": "mysetting",
"properties": {
"storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1",
"workspaceId": "",
"eventHubAuthorizationRuleId": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule",
"marketplacePartnerId": "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1",
"metrics": [
{
"category": "WorkflowMetrics",
"enabled": true,
"retentionPolicy": {
"enabled": false,
"days": 0
}
}
],
"logs": [
{
"categoryGroup": "allLogs",
"enabled": true,
"retentionPolicy": {
"enabled": false,
"days": 0
}
}
]
}
}
Gets the diagnostic setting for category
Sample request
GET https://management.azure.com/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/Microsoft.Insights/diagnosticSettings/mysetting?api-version=2021-05-01-preview
/**
* Samples for DiagnosticSettingsOperation Get.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/
* getDiagnosticSettingCategory.json
*/
/**
* Sample code: Gets the diagnostic setting for category.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getsTheDiagnosticSettingForCategory(com.azure.resourcemanager.AzureResourceManager azure) {
azure.diagnosticSettings().manager().serviceClient().getDiagnosticSettingsOperations().getWithResponse(
"subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6",
"mysetting", com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmonitor_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingCategory.json
func ExampleDiagnosticSettingsClient_Get_getsTheDiagnosticSettingForCategory() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmonitor.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewDiagnosticSettingsClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{
// Name: to.Ptr("mysetting"),
// Type: to.Ptr(""),
// ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/service"),
// Properties: &armmonitor.DiagnosticSettings{
// EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"),
// Logs: []*armmonitor.LogSettings{
// {
// Category: to.Ptr("WorkflowRuntime"),
// Enabled: to.Ptr(true),
// RetentionPolicy: &armmonitor.RetentionPolicy{
// Days: to.Ptr[int32](0),
// Enabled: to.Ptr(false),
// },
// }},
// MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"),
// Metrics: []*armmonitor.MetricSettings{
// {
// Category: to.Ptr("WorkflowMetrics"),
// Enabled: to.Ptr(true),
// RetentionPolicy: &armmonitor.RetentionPolicy{
// Days: to.Ptr[int32](0),
// Enabled: to.Ptr(false),
// },
// }},
// StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"),
// WorkspaceID: to.Ptr(""),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MonitorClient } = require("@azure/arm-monitor");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets the active diagnostic settings for the specified resource.
*
* @summary Gets the active diagnostic settings for the specified resource.
* x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingCategory.json
*/
async function getsTheDiagnosticSettingForCategory() {
const resourceUri =
"subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6";
const name = "mysetting";
const credential = new DefaultAzureCredential();
const client = new MonitorClient(credential);
const result = await client.diagnosticSettings.get(resourceUri, name);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Monitor;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingCategory.json
// this example is just showing the usage of "DiagnosticSettings_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this DiagnosticSettingResource created on azure
// for more information of creating DiagnosticSettingResource, please refer to the document of DiagnosticSettingResource
string resourceUri = "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6";
string name = "mysetting";
ResourceIdentifier diagnosticSettingResourceId = DiagnosticSettingResource.CreateResourceIdentifier(resourceUri, name);
DiagnosticSettingResource diagnosticSetting = client.GetDiagnosticSettingResource(diagnosticSettingResourceId);
// invoke the operation
DiagnosticSettingResource result = await diagnosticSetting.GetAsync();
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
DiagnosticSettingData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/service",
"type": "",
"name": "mysetting",
"properties": {
"storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1",
"workspaceId": "",
"eventHubAuthorizationRuleId": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule",
"marketplacePartnerId": "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1",
"metrics": [
{
"category": "WorkflowMetrics",
"enabled": true,
"retentionPolicy": {
"enabled": false,
"days": 0
}
}
],
"logs": [
{
"category": "WorkflowRuntime",
"enabled": true,
"retentionPolicy": {
"enabled": false,
"days": 0
}
}
]
}
}
Definitions
Name |
Description |
createdByType
|
The type of identity that created the resource.
|
DiagnosticSettingsResource
|
The diagnostic setting resource.
|
ErrorResponse
|
Describes the format of Error response.
|
LogSettings
|
Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log.
|
MetricSettings
|
Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric.
|
RetentionPolicy
|
Specifies the retention policy for the log.
|
systemData
|
Metadata pertaining to creation and last modification of the resource.
|
createdByType
The type of identity that created the resource.
Name |
Type |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
DiagnosticSettingsResource
The diagnostic setting resource.
Name |
Type |
Description |
id
|
string
|
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
The name of the resource
|
properties.eventHubAuthorizationRuleId
|
string
|
The resource Id for the event hub authorization rule.
|
properties.eventHubName
|
string
|
The name of the event hub. If none is specified, the default event hub will be selected.
|
properties.logAnalyticsDestinationType
|
string
|
A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.)
|
properties.logs
|
LogSettings[]
|
The list of logs settings.
|
properties.marketplacePartnerId
|
string
|
The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs.
|
properties.metrics
|
MetricSettings[]
|
The list of metric settings.
|
properties.serviceBusRuleId
|
string
|
The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
|
properties.storageAccountId
|
string
|
The resource ID of the storage account to which you would like to send Diagnostic Logs.
|
properties.workspaceId
|
string
|
The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2
|
systemData
|
systemData
|
The system metadata related to this resource.
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
ErrorResponse
Describes the format of Error response.
Name |
Type |
Description |
code
|
string
|
Error code
|
message
|
string
|
Error message indicating why the operation failed.
|
LogSettings
Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log.
Name |
Type |
Description |
category
|
string
|
Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.
|
categoryGroup
|
string
|
Name of a Diagnostic Log category group for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.
|
enabled
|
boolean
|
a value indicating whether this log is enabled.
|
retentionPolicy
|
RetentionPolicy
|
the retention policy for this log.
|
MetricSettings
Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric.
Name |
Type |
Description |
category
|
string
|
Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation.
|
enabled
|
boolean
|
a value indicating whether this category is enabled.
|
retentionPolicy
|
RetentionPolicy
|
the retention policy for this category.
|
timeGrain
|
string
|
the timegrain of the metric in ISO8601 format.
|
RetentionPolicy
Specifies the retention policy for the log.
Name |
Type |
Description |
days
|
integer
|
the number of days for the retention in days. A value of 0 will retain the events indefinitely.
|
enabled
|
boolean
|
a value indicating whether the retention policy is enabled.
|
systemData
Metadata pertaining to creation and last modification of the resource.
Name |
Type |
Description |
createdAt
|
string
|
The timestamp of resource creation (UTC).
|
createdBy
|
string
|
The identity that created the resource.
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
lastModifiedAt
|
string
|
The timestamp of resource last modification (UTC)
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
lastModifiedByType
|
createdByType
|
The type of identity that last modified the resource.
|