Erstellt (oder aktualisiert) ein Log Analytics QueryPack. Hinweis: Sie können keinen anderen Wert für InstrumentationKey oder AppId im Put-Vorgang angeben.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks/{queryPackName}?api-version=2019-09-01
URI-Parameter
Name |
In |
Erforderlich |
Typ |
Beschreibung |
queryPackName
|
path |
True
|
string
|
Der Name der Log Analytics QueryPack-Ressource.
|
resourceGroupName
|
path |
True
|
string
|
Der Name der Ressourcengruppe. Für den Namen wird die Groß-/Kleinschreibung nicht beachtet.
|
subscriptionId
|
path |
True
|
string
|
Hierbei handelt es sich um die ID des Zielabonnements.
|
api-version
|
query |
True
|
string
|
Hierbei handelt es sich um die für diesen Vorgang zu verwendende API-Version.
|
Anforderungstext
Name |
Erforderlich |
Typ |
Beschreibung |
location
|
True
|
string
|
Ressourcenspeicherort
|
tags
|
|
object
|
Ressourcentags
|
Antworten
Name |
Typ |
Beschreibung |
200 OK
|
LogAnalyticsQueryPack
|
Erfolgreiche Anforderung beim Erstellen oder Aktualisieren eines Log Analytics-Abfragepakets. Das aktualisierte QueryPack wird zurückgegeben.
|
Other Status Codes
|
ErrorResponse
|
Fehlerantwort mit Beschreibung des Grunds für den Fehler.
|
Sicherheit
azure_auth
Azure Active Directory-OAuth2-Flow
Typ:
oauth2
Ablauf:
implicit
Autorisierungs-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiche
Name |
Beschreibung |
user_impersonation
|
Identitätswechsel Ihres Benutzerkontos
|
Beispiele
QueryPackCreate
Beispielanforderung
PUT https://management.azure.com/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/queryPacks/my-querypack?api-version=2019-09-01
{
"location": "South Central US",
"properties": {}
}
import java.util.HashMap;
import java.util.Map;
/** Samples for QueryPacks CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksCreate.json
*/
/**
* Sample code: QueryPackCreate.
*
* @param manager Entry point to LogAnalyticsManager.
*/
public static void queryPackCreate(com.azure.resourcemanager.loganalytics.LogAnalyticsManager manager) {
manager
.queryPacks()
.define("my-querypack")
.withRegion("South Central US")
.withExistingResourceGroup("my-resource-group")
.create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armoperationalinsights_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/operationalinsights/armoperationalinsights/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4ce13e8353a25125a41bc01705c0a7794dac32a7/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksCreate.json
func ExampleQueryPacksClient_CreateOrUpdate_queryPackCreate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armoperationalinsights.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewQueryPacksClient().CreateOrUpdate(ctx, "my-resource-group", "my-querypack", armoperationalinsights.LogAnalyticsQueryPack{
Location: to.Ptr("South Central US"),
Properties: &armoperationalinsights.LogAnalyticsQueryPackProperties{},
}, 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.LogAnalyticsQueryPack = armoperationalinsights.LogAnalyticsQueryPack{
// Name: to.Ptr("my-querypack"),
// Type: to.Ptr("microsoft.operationalinsights/querypacks"),
// ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.operationalinsights/queryPacks/my-querypack"),
// Location: to.Ptr("South Central US"),
// Tags: map[string]*string{
// },
// Properties: &armoperationalinsights.LogAnalyticsQueryPackProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// QueryPackID: to.Ptr("d1c8fc00-2b68-441e-8f9b-ded8748dc635"),
// TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-04T12:37:56.854Z"); return t}()),
// TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-04T12:37:56.854Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { OperationalInsightsManagementClient } = require("@azure/arm-operationalinsights");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates (or updates) a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation.
*
* @summary Creates (or updates) a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation.
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksCreate.json
*/
async function queryPackCreate() {
const subscriptionId =
process.env["OPERATIONALINSIGHTS_SUBSCRIPTION_ID"] || "86dc51d3-92ed-4d7e-947a-775ea79b4919";
const resourceGroupName =
process.env["OPERATIONALINSIGHTS_RESOURCE_GROUP"] || "my-resource-group";
const queryPackName = "my-querypack";
const logAnalyticsQueryPackPayload = {
location: "South Central US",
};
const credential = new DefaultAzureCredential();
const client = new OperationalInsightsManagementClient(credential, subscriptionId);
const result = await client.queryPacks.createOrUpdate(
resourceGroupName,
queryPackName,
logAnalyticsQueryPackPayload
);
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.Resources;
using Azure.ResourceManager.OperationalInsights;
// Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksCreate.json
// this example is just showing the usage of "QueryPacks_CreateOrUpdate" 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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "86dc51d3-92ed-4d7e-947a-775ea79b4919";
string resourceGroupName = "my-resource-group";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this LogAnalyticsQueryPackResource
LogAnalyticsQueryPackCollection collection = resourceGroupResource.GetLogAnalyticsQueryPacks();
// invoke the operation
string queryPackName = "my-querypack";
LogAnalyticsQueryPackData data = new LogAnalyticsQueryPackData(new AzureLocation("South Central US"));
ArmOperation<LogAnalyticsQueryPackResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, queryPackName, data);
LogAnalyticsQueryPackResource result = lro.Value;
// 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
LogAnalyticsQueryPackData 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
Beispiel für eine Antwort
{
"id": "/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.operationalinsights/queryPacks/my-querypack",
"name": "my-querypack",
"type": "microsoft.operationalinsights/querypacks",
"location": "South Central US",
"tags": {},
"properties": {
"queryPackId": "d1c8fc00-2b68-441e-8f9b-ded8748dc635",
"timeCreated": "2019-08-04T12:37:56.8543652Z",
"timeModified": "2019-08-04T12:37:56.8543652Z",
"provisioningState": "Succeeded"
}
}
QueryPackUpdate
Beispielanforderung
PUT https://management.azure.com/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/queryPacks/my-querypack?api-version=2019-09-01
{
"location": "South Central US",
"tags": {
"Tag1": "Value1"
},
"properties": {}
}
import java.util.HashMap;
import java.util.Map;
/** Samples for QueryPacks CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksUpdate.json
*/
/**
* Sample code: QueryPackUpdate.
*
* @param manager Entry point to LogAnalyticsManager.
*/
public static void queryPackUpdate(com.azure.resourcemanager.loganalytics.LogAnalyticsManager manager) {
manager
.queryPacks()
.define("my-querypack")
.withRegion("South Central US")
.withExistingResourceGroup("my-resource-group")
.withTags(mapOf("Tag1", "Value1"))
.create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armoperationalinsights_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/operationalinsights/armoperationalinsights/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4ce13e8353a25125a41bc01705c0a7794dac32a7/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksUpdate.json
func ExampleQueryPacksClient_CreateOrUpdate_queryPackUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armoperationalinsights.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewQueryPacksClient().CreateOrUpdate(ctx, "my-resource-group", "my-querypack", armoperationalinsights.LogAnalyticsQueryPack{
Location: to.Ptr("South Central US"),
Tags: map[string]*string{
"Tag1": to.Ptr("Value1"),
},
Properties: &armoperationalinsights.LogAnalyticsQueryPackProperties{},
}, 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.LogAnalyticsQueryPack = armoperationalinsights.LogAnalyticsQueryPack{
// Name: to.Ptr("my-querypack"),
// Type: to.Ptr("microsoft.operationalinsights/querypacks"),
// ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.operationalinsights/queryPacks/my-querypack"),
// Location: to.Ptr("South Central US"),
// Tags: map[string]*string{
// "Tag1": to.Ptr("Value1"),
// },
// Properties: &armoperationalinsights.LogAnalyticsQueryPackProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// QueryPackID: to.Ptr("aac8fc00-2b68-441e-8f9b-ded8748dc635"),
// TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-04T12:37:56.854Z"); return t}()),
// TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-04T12:37:56.854Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { OperationalInsightsManagementClient } = require("@azure/arm-operationalinsights");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates (or updates) a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation.
*
* @summary Creates (or updates) a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation.
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksUpdate.json
*/
async function queryPackUpdate() {
const subscriptionId =
process.env["OPERATIONALINSIGHTS_SUBSCRIPTION_ID"] || "86dc51d3-92ed-4d7e-947a-775ea79b4919";
const resourceGroupName =
process.env["OPERATIONALINSIGHTS_RESOURCE_GROUP"] || "my-resource-group";
const queryPackName = "my-querypack";
const logAnalyticsQueryPackPayload = {
location: "South Central US",
tags: { tag1: "Value1" },
};
const credential = new DefaultAzureCredential();
const client = new OperationalInsightsManagementClient(credential, subscriptionId);
const result = await client.queryPacks.createOrUpdate(
resourceGroupName,
queryPackName,
logAnalyticsQueryPackPayload
);
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.Resources;
using Azure.ResourceManager.OperationalInsights;
// Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksUpdate.json
// this example is just showing the usage of "QueryPacks_CreateOrUpdate" 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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "86dc51d3-92ed-4d7e-947a-775ea79b4919";
string resourceGroupName = "my-resource-group";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this LogAnalyticsQueryPackResource
LogAnalyticsQueryPackCollection collection = resourceGroupResource.GetLogAnalyticsQueryPacks();
// invoke the operation
string queryPackName = "my-querypack";
LogAnalyticsQueryPackData data = new LogAnalyticsQueryPackData(new AzureLocation("South Central US"))
{
Tags =
{
["Tag1"] = "Value1",
},
};
ArmOperation<LogAnalyticsQueryPackResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, queryPackName, data);
LogAnalyticsQueryPackResource result = lro.Value;
// 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
LogAnalyticsQueryPackData 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
Beispiel für eine Antwort
{
"id": "/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.operationalinsights/queryPacks/my-querypack",
"name": "my-querypack",
"type": "microsoft.operationalinsights/querypacks",
"location": "South Central US",
"tags": {
"Tag1": "Value1"
},
"properties": {
"queryPackId": "aac8fc00-2b68-441e-8f9b-ded8748dc635",
"timeCreated": "2019-06-04T12:37:56.8543652Z",
"timeModified": "2019-08-04T12:37:56.8543652Z",
"provisioningState": "Succeeded"
}
}
Definitionen
ErrorAdditionalInfo
Zusätzliche Informationen zum Ressourcenverwaltungsfehler.
Name |
Typ |
Beschreibung |
info
|
object
|
Zusätzliche Informationen.
|
type
|
string
|
Typ der zusätzlichen Informationen.
|
ErrorDetail
Die Fehlerdetails.
Name |
Typ |
Beschreibung |
additionalInfo
|
ErrorAdditionalInfo[]
|
Die zusätzlichen Fehlerinformationen.
|
code
|
string
|
Der Fehlercode.
|
details
|
ErrorDetail[]
|
Die Fehlerdetails.
|
message
|
string
|
Die Fehlermeldung.
|
target
|
string
|
Das Fehlerziel.
|
ErrorResponse
Fehlerantwort
Name |
Typ |
Beschreibung |
error
|
ErrorDetail
|
Das Fehlerobjekt.
|
LogAnalyticsQueryPack
Eine Log Analytics QueryPack-Definition.
Name |
Typ |
Beschreibung |
id
|
string
|
Azure-Ressourcen-ID
|
location
|
string
|
Ressourcenspeicherort
|
name
|
string
|
Name der Azure-Ressource
|
properties.provisioningState
|
string
|
Aktueller Status dieses QueryPack: Gibt an, ob innerhalb der definierten Ressourcengruppe bereitgestellt wurde oder nicht. Benutzer können diesen Wert nicht ändern, können aber daraus lesen. Zu den Werten gehören Succeeded, Deploying, Canceled und Failed.
|
properties.queryPackId
|
string
|
Die eindeutige ID Ihrer Anwendung. Dieses Feld kann nicht geändert werden.
|
properties.timeCreated
|
string
|
Erstellungsdatum für das Log Analytics QueryPack im ISO 8601-Format.
|
properties.timeModified
|
string
|
Datum der letzten Änderung des Log Analytics QueryPack im ISO 8601-Format.
|
tags
|
object
|
Ressourcentags
|
type
|
string
|
Azure-Ressourcentyp
|