Répertoriez les profils de journal.
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles?api-version=2016-03-01
Paramètres URI
Nom |
Dans |
Obligatoire |
Type |
Description |
subscriptionId
|
path |
True
|
string
|
ID de l’abonnement cible.
|
api-version
|
query |
True
|
string
|
Version de l’API à utiliser pour cette opération.
|
Réponses
Sécurité
azure_auth
Flux OAuth2 Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nom |
Description |
user_impersonation
|
Emprunter l’identité de votre compte d’utilisateur
|
Exemples
List log profiles
Sample Request
GET https://management.azure.com/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/Microsoft.Insights/logprofiles?api-version=2016-03-01
/**
* Samples for LogProfiles List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listLogProfile.json
*/
/**
* Sample code: List log profiles.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listLogProfiles(com.azure.resourcemanager.AzureResourceManager azure) {
azure.diagnosticSettings().manager().serviceClient().getLogProfiles().list(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/stable/2016-03-01/examples/listLogProfile.json
func ExampleLogProfilesClient_NewListPager() {
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)
}
pager := clientFactory.NewLogProfilesClient().NewListPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.LogProfileCollection = armmonitor.LogProfileCollection{
// Value: []*armmonitor.LogProfileResource{
// {
// Name: to.Ptr("default"),
// Type: to.Ptr(""),
// ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"),
// Location: to.Ptr(""),
// Properties: &armmonitor.LogProfileProperties{
// Categories: []*string{
// to.Ptr("Delete"),
// to.Ptr("Write"),
// to.Ptr("Action")},
// Locations: []*string{
// to.Ptr("global")},
// RetentionPolicy: &armmonitor.RetentionPolicy{
// Days: to.Ptr[int32](3),
// Enabled: to.Ptr(true),
// },
// ServiceBusRuleID: to.Ptr(""),
// StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"),
// },
// },
// {
// Name: to.Ptr("default2"),
// Type: to.Ptr(""),
// ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default2"),
// Location: to.Ptr(""),
// Properties: &armmonitor.LogProfileProperties{
// Categories: []*string{
// to.Ptr("Delete"),
// to.Ptr("Write"),
// to.Ptr("Action")},
// Locations: []*string{
// to.Ptr("global")},
// RetentionPolicy: &armmonitor.RetentionPolicy{
// Days: to.Ptr[int32](15),
// Enabled: to.Ptr(true),
// },
// ServiceBusRuleID: to.Ptr(""),
// StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8165"),
// },
// }},
// }
}
}
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 List the log profiles.
*
* @summary List the log profiles.
* x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listLogProfile.json
*/
async function listLogProfiles() {
const subscriptionId =
process.env["MONITOR_SUBSCRIPTION_ID"] || "df602c9c-7aa0-407d-a6fb-eb20c8bd1192";
const credential = new DefaultAzureCredential();
const client = new MonitorClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.logProfiles.list()) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Monitor;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listLogProfile.json
// this example is just showing the usage of "LogProfiles_List" 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 SubscriptionResource created on azure
// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
string subscriptionId = "df602c9c-7aa0-407d-a6fb-eb20c8bd1192";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
// get the collection of this LogProfileResource
LogProfileCollection collection = subscriptionResource.GetLogProfiles();
// invoke the operation and iterate over the result
await foreach (LogProfileResource item in collection.GetAllAsync())
{
// the variable item 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
LogProfileData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
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
{
"value": [
{
"id": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default",
"type": "",
"name": "default",
"location": "",
"tags": null,
"properties": {
"storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162",
"serviceBusRuleId": "",
"locations": [
"global"
],
"categories": [
"Delete",
"Write",
"Action"
],
"retentionPolicy": {
"enabled": true,
"days": 3
}
}
},
{
"id": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default2",
"type": "",
"name": "default2",
"location": "",
"tags": null,
"properties": {
"storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8165",
"serviceBusRuleId": "",
"locations": [
"global"
],
"categories": [
"Delete",
"Write",
"Action"
],
"retentionPolicy": {
"enabled": true,
"days": 15
}
}
}
]
}
Définitions
LogProfileCollection
Représente une collection de profils de journal.
LogProfileResource
Ressource de profil de journal.
Nom |
Type |
Description |
id
|
string
|
ID de ressource Azure
|
location
|
string
|
Emplacement de la ressource
|
name
|
string
|
Nom de la ressource Azure
|
properties.categories
|
string[]
|
catégories des journaux. Ces catégories sont créées comme il convient à l’utilisateur. Certaines valeurs sont « Write », « Delete » et/ou « Action ».
|
properties.locations
|
string[]
|
Liste des régions pour lesquelles les événements du journal d’activité doivent être stockés ou diffusés en continu. Il s’agit d’une liste séparée par des virgules des emplacements ARM valides, y compris l’emplacement « global ».
|
properties.retentionPolicy
|
RetentionPolicy
|
stratégie de rétention pour les événements dans le journal.
|
properties.serviceBusRuleId
|
string
|
ID de règle Service Bus de l’espace de noms Service Bus dans lequel vous souhaitez que Event Hubs soit créé pour diffuser le journal d’activité. L’ID de règle est au format « {ID de ressource service bus}/authorizationrules/{nom de clé} ».
|
properties.storageAccountId
|
string
|
ID de ressource du compte de stockage auquel vous souhaitez envoyer le journal d’activité.
|
tags
|
object
|
Balises de ressource
|
type
|
string
|
Type de ressource Azure
|
RetentionPolicy
Spécifie la stratégie de rétention pour le journal.
Nom |
Type |
Description |
days
|
integer
|
nombre de jours pour la rétention en jours. La valeur 0 conservera les événements indéfiniment.
|
enabled
|
boolean
|
valeur indiquant si la stratégie de rétention est activée.
|