Pobiera aktywne ustawienia diagnostyczne dla określonego zasobu.
GET https://management.azure.com/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}?api-version=2021-05-01-preview
Parametry identyfikatora URI
Nazwa |
W |
Wymagane |
Typ |
Opis |
name
|
path |
True
|
string
|
Nazwa ustawienia diagnostycznego.
|
resourceUri
|
path |
True
|
string
|
Identyfikator zasobu.
|
api-version
|
query |
True
|
string
|
Wersja interfejsu API do użycia dla tej operacji.
|
Odpowiedzi
Nazwa |
Typ |
Opis |
200 OK
|
DiagnosticSettingsResource
|
Pomyślne żądanie uzyskania dodatkowych informacji o ustawieniu diagnostycznym
|
Other Status Codes
|
ErrorResponse
|
Odpowiedź na błąd opisująca, dlaczego operacja nie powiodła się.
|
Zabezpieczenia
azure_auth
Przepływ OAuth2 usługi Azure Active Directory
Typ:
oauth2
Flow:
implicit
Adres URL autoryzacji:
https://login.microsoftonline.com/common/oauth2/authorize
Zakresy
Nazwa |
Opis |
user_impersonation
|
personifikacja konta użytkownika
|
Przykłady
Gets the diagnostic setting
Przykładowe żądanie
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
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
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
Przykładowa odpowiedź
{
"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
}
}
]
}
}
Definicje
createdByType
Typ tożsamości, która utworzyła zasób.
Nazwa |
Typ |
Opis |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
DiagnosticSettingsResource
Zasób ustawienia diagnostycznego.
Nazwa |
Typ |
Opis |
id
|
string
|
W pełni kwalifikowany identyfikator zasobu dla zasobu. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
Nazwa zasobu
|
properties.eventHubAuthorizationRuleId
|
string
|
Identyfikator zasobu reguły autoryzacji centrum zdarzeń.
|
properties.eventHubName
|
string
|
Nazwa centrum zdarzeń. Jeśli żaden z nich nie zostanie określony, zostanie wybrane domyślne centrum zdarzeń.
|
properties.logAnalyticsDestinationType
|
string
|
Ciąg wskazujący, czy eksport do usługi Log Analytics powinien używać domyślnego typu docelowego, tj. AzureDiagnostics, czy użyć typu docelowego skonstruowanego w następujący sposób: _. Możliwe wartości to: Dedykowane i null (wartość null jest domyślna).
|
properties.logs
|
LogSettings[]
|
Lista ustawień dzienników.
|
properties.marketplacePartnerId
|
string
|
Pełny identyfikator zasobu usługi ARM zasobu witryny Marketplace, do którego chcesz wysłać dzienniki diagnostyczne.
|
properties.metrics
|
MetricSettings[]
|
Lista ustawień metryk.
|
properties.serviceBusRuleId
|
string
|
Identyfikator reguły usługi Service Bus ustawienia diagnostycznego. Jest to tutaj, aby zachować zgodność z poprzednimi wersjami.
|
properties.storageAccountId
|
string
|
Identyfikator zasobu konta magazynu, do którego chcesz wysłać dzienniki diagnostyczne.
|
properties.workspaceId
|
string
|
Pełny identyfikator zasobu usługi ARM obszaru roboczego usługi Log Analytics, do którego chcesz wysłać dzienniki diagnostyczne. Przykład: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2
|
systemData
|
systemData
|
Metadane systemowe związane z tym zasobem.
|
type
|
string
|
Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts"
|
ErrorResponse
Opisuje format odpowiedzi Błąd.
Nazwa |
Typ |
Opis |
code
|
string
|
Kod błędu
|
message
|
string
|
Komunikat o błędzie wskazujący, dlaczego operacja nie powiodła się.
|
LogSettings
Część funkcji MultiTenantDiagnosticSettings. Określa ustawienia dla określonego dziennika.
Nazwa |
Typ |
Opis |
category
|
string
|
Nazwa kategorii dzienników diagnostycznych dla typu zasobu, do których jest stosowane to ustawienie. Aby uzyskać listę kategorii dzienników diagnostycznych dla zasobu, najpierw wykonaj operację GET ustawień diagnostycznych.
|
categoryGroup
|
string
|
Nazwa grupy kategorii dzienników diagnostycznych dla typu zasobu, do których jest stosowane to ustawienie. Aby uzyskać listę kategorii dzienników diagnostycznych dla zasobu, najpierw wykonaj operację GET ustawień diagnostycznych.
|
enabled
|
boolean
|
wartość wskazująca, czy ten dziennik jest włączony.
|
retentionPolicy
|
RetentionPolicy
|
zasady przechowywania dla tego dziennika.
|
MetricSettings
Część funkcji MultiTenantDiagnosticSettings. Określa ustawienia dla określonej metryki.
Nazwa |
Typ |
Opis |
category
|
string
|
Nazwa kategorii Metryka diagnostyczna dla typu zasobu, do których jest stosowane to ustawienie. Aby uzyskać listę kategorii metryk diagnostycznych dla zasobu, najpierw wykonaj operację GET ustawień diagnostycznych.
|
enabled
|
boolean
|
wartość wskazująca, czy ta kategoria jest włączona.
|
retentionPolicy
|
RetentionPolicy
|
zasady przechowywania dla tej kategorii.
|
timeGrain
|
string
|
wartość timegrain metryki w formacie ISO8601.
|
RetentionPolicy
Określa zasady przechowywania dziennika.
Nazwa |
Typ |
Opis |
days
|
integer
|
liczba dni przechowywania w dniach. Wartość 0 zachowuje zdarzenia na czas nieokreślony.
|
enabled
|
boolean
|
wartość wskazująca, czy zasady przechowywania są włączone.
|
systemData
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
Nazwa |
Typ |
Opis |
createdAt
|
string
|
Sygnatura czasowa tworzenia zasobów (UTC).
|
createdBy
|
string
|
Tożsamość, która utworzyła zasób.
|
createdByType
|
createdByType
|
Typ tożsamości, która utworzyła zasób.
|
lastModifiedAt
|
string
|
Sygnatura czasowa ostatniej modyfikacji zasobu (UTC)
|
lastModifiedBy
|
string
|
Tożsamość, która ostatnio zmodyfikowała zasób.
|
lastModifiedByType
|
createdByType
|
Typ tożsamości, która ostatnio zmodyfikowała zasób.
|