Initiieren sie die Problembehandlung für eine angegebene Ressource.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot?api-version=2024-05-01
URI-Parameter
Name |
In |
Erforderlich |
Typ |
Beschreibung |
networkWatcherName
|
path |
True
|
string
|
Der Name der Netzwerküberwachungsressource.
|
resourceGroupName
|
path |
True
|
string
|
Der Name der Ressourcengruppe.
|
subscriptionId
|
path |
True
|
string
|
Die Abonnementanmeldeinformationen, die das Microsoft Azure-Abonnement eindeutig identifizieren. Die Abonnement-ID ist Teil des URI für jeden Dienstaufruf.
|
api-version
|
query |
True
|
string
|
Client-API-Version.
|
Anforderungstext
Name |
Erforderlich |
Typ |
Beschreibung |
properties.storageId
|
True
|
string
|
Die ID für das Speicherkonto, um das Problembehandlungsergebnis zu speichern.
|
properties.storagePath
|
True
|
string
|
Der Pfad zum Blob zum Speichern des Problembehandlungsergebnisses.
|
targetResourceId
|
True
|
string
|
Die Zielressource zur Problembehandlung.
|
Antworten
Name |
Typ |
Beschreibung |
200 OK
|
TroubleshootingResult
|
Erfolgreiche Problembehandlungsanforderung.
|
202 Accepted
|
TroubleshootingResult
|
Akzeptierte Anforderung zur Problembehandlung.
|
Other Status Codes
|
ErrorResponse
|
Fehlerantwort, die beschreibt, warum der Vorgang fehlgeschlagen ist.
|
Sicherheit
azure_auth
Azure Active Directory OAuth2-Fluss.
Typ:
oauth2
Ablauf:
implicit
Autorisierungs-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiche
Name |
Beschreibung |
user_impersonation
|
Identitätswechsel ihres Benutzerkontos
|
Beispiele
Get troubleshooting
Beispielanforderung
POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/troubleshoot?api-version=2024-05-01
{
"targetResourceId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1",
"properties": {
"storageId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1",
"storagePath": "https://st1.blob.core.windows.net/cn1"
}
}
import com.azure.resourcemanager.network.models.TroubleshootingParameters;
/**
* Samples for NetworkWatchers GetTroubleshooting.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/NetworkWatcherTroubleshootGet
* .json
*/
/**
* Sample code: Get troubleshooting.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getTroubleshooting(com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getNetworkWatchers().getTroubleshooting("rg1", "nw1",
new TroubleshootingParameters()
.withTargetResourceId(
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1")
.withStorageId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1")
.withStoragePath("https://st1.blob.core.windows.net/cn1"),
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
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python network_watcher_troubleshoot_get.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.network_watchers.begin_get_troubleshooting(
resource_group_name="rg1",
network_watcher_name="nw1",
parameters={
"properties": {
"storageId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1",
"storagePath": "https://st1.blob.core.windows.net/cn1",
},
"targetResourceId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1",
},
).result()
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/NetworkWatcherTroubleshootGet.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_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/network/armnetwork/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ab04533261eff228f28e08900445d0edef3eb70c/specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/NetworkWatcherTroubleshootGet.json
func ExampleWatchersClient_BeginGetTroubleshooting() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewWatchersClient().BeginGetTroubleshooting(ctx, "rg1", "nw1", armnetwork.TroubleshootingParameters{
Properties: &armnetwork.TroubleshootingProperties{
StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1"),
StoragePath: to.Ptr("https://st1.blob.core.windows.net/cn1"),
},
TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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.TroubleshootingResult = armnetwork.TroubleshootingResult{
// Code: to.Ptr("UnHealthy"),
// EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-12T00:20:09.914Z"); return t}()),
// Results: []*armnetwork.TroubleshootingDetails{
// {
// Detail: to.Ptr("During this time S2S VPN tunnels to on premises sites or other Azure virtual networks will be disconnected"),
// ID: to.Ptr("000000"),
// ReasonType: to.Ptr("VipUnResponsive"),
// RecommendedActions: []*armnetwork.TroubleshootingRecommendedActions{
// {
// ActionText: to.Ptr("Verify if there is a network security group (NSG) applied to the GatewaySubnet"),
// ActionURI: to.Ptr("https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-create-nsg-arm-pportal"),
// ActionURIText: to.Ptr("Verify"),
// },
// {
// ActionText: to.Ptr("If your VPN gateway isn't up and running by the expected resolution time, contact support"),
// ActionURI: to.Ptr("http://azure.microsoft.com/support"),
// ActionURIText: to.Ptr("contact support"),
// }},
// Summary: to.Ptr("We are sorry, your VPN gateway is unreachable from the Internet"),
// }},
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-12T00:19:47.044Z"); 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 { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Initiate troubleshooting on a specified resource.
*
* @summary Initiate troubleshooting on a specified resource.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/NetworkWatcherTroubleshootGet.json
*/
async function getTroubleshooting() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const networkWatcherName = "nw1";
const parameters = {
storageId:
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1",
storagePath: "https://st1.blob.core.windows.net/cn1",
targetResourceId:
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1",
};
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.networkWatchers.beginGetTroubleshootingAndWait(
resourceGroupName,
networkWatcherName,
parameters,
);
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.Models;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Network;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/NetworkWatcherTroubleshootGet.json
// this example is just showing the usage of "NetworkWatchers_GetTroubleshooting" 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 NetworkWatcherResource created on azure
// for more information of creating NetworkWatcherResource, please refer to the document of NetworkWatcherResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string networkWatcherName = "nw1";
ResourceIdentifier networkWatcherResourceId = NetworkWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkWatcherName);
NetworkWatcherResource networkWatcher = client.GetNetworkWatcherResource(networkWatcherResourceId);
// invoke the operation
TroubleshootingContent content = new TroubleshootingContent(new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1"), new Uri("https://st1.blob.core.windows.net/cn1"));
ArmOperation<TroubleshootingResult> lro = await networkWatcher.GetTroubleshootingAsync(WaitUntil.Completed, content);
TroubleshootingResult result = lro.Value;
Console.WriteLine($"Succeeded: {result}");
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
{
"startTime": "2017-01-12T00:19:47.0442834Z",
"endTime": "2017-01-12T00:20:09.914Z",
"code": "UnHealthy",
"results": [
{
"id": "000000",
"reasonType": "VipUnResponsive",
"summary": "We are sorry, your VPN gateway is unreachable from the Internet",
"detail": "During this time S2S VPN tunnels to on premises sites or other Azure virtual networks will be disconnected",
"recommendedActions": [
{
"actionText": "Verify if there is a network security group (NSG) applied to the GatewaySubnet",
"actionUri": "https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-create-nsg-arm-pportal",
"actionUriText": "Verify"
},
{
"actionText": "If your VPN gateway isn't up and running by the expected resolution time, contact support",
"actionUri": "http://azure.microsoft.com/support",
"actionUriText": "contact support"
}
]
}
]
}
Location: https:/management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/troubleshoot?api-version=2024-05-01
{
"startTime": "2017-01-12T00:19:47.0442834Z",
"endTime": "2017-01-12T00:20:09.914Z",
"code": "UnHealthy",
"results": [
{
"id": "000000",
"reasonType": "VipUnResponsive",
"summary": "We are sorry, your VPN gateway is unreachable from the Internet",
"detail": "During this time S2S VPN tunnels to on premises sites or other Azure virtual networks will be disconnected",
"recommendedActions": [
{
"actionText": "Verify if there is a network security group (NSG) applied to the GatewaySubnet",
"actionUri": "https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-create-nsg-arm-pportal",
"actionUriText": "Verify"
},
{
"actionText": "If your VPN gateway isn't up and running by the expected resolution time, contact support",
"actionUri": "http://azure.microsoft.com/support",
"actionUriText": "contact support"
}
]
}
]
}
Definitionen
ErrorDetails
Objekt
Allgemeine Fehlerdetails darstellung.
Name |
Typ |
Beschreibung |
code
|
string
|
Fehlercode.
|
message
|
string
|
Fehlermeldung.
|
target
|
string
|
Fehlerziel.
|
ErrorResponse
Objekt
Das Fehlerobjekt.
Name |
Typ |
Beschreibung |
error
|
ErrorDetails
|
Fehler
Das Fehlerdetails-Objekt.
|
TroubleshootingDetails
Objekt
Aus der Problembehandlung der angegebenen Ressource gewonnene Informationen.
Name |
Typ |
Beschreibung |
detail
|
string
|
Details zur Problembehandlung.
|
id
|
string
|
Die ID des Vorgangs "Problembehandlung abrufen".
|
reasonType
|
string
|
Grundtyp des Fehlers.
|
recommendedActions
|
TroubleshootingRecommendedActions[]
|
Liste der empfohlenen Aktionen.
|
summary
|
string
|
Eine Zusammenfassung der Problembehandlung.
|
TroubleshootingParameters
Objekt
Parameter, die die Ressource für die Problembehandlung definieren.
Name |
Typ |
Beschreibung |
properties.storageId
|
string
|
Die ID für das Speicherkonto, um das Problembehandlungsergebnis zu speichern.
|
properties.storagePath
|
string
|
Der Pfad zum Blob zum Speichern des Problembehandlungsergebnisses.
|
targetResourceId
|
string
|
Die Zielressource zur Problembehandlung.
|
TroubleshootingRecommendedActions
Objekt
Empfohlene Aktionen basierend auf ermittelten Problemen.
Name |
Typ |
Beschreibung |
actionId
|
string
|
ID der empfohlenen Aktion.
|
actionText
|
string
|
Beschreibung der empfohlenen Aktionen.
|
actionUri
|
string
|
Der URI-Link zu einer Dokumentation für die empfohlenen Problembehandlungsaktionen.
|
actionUriText
|
string
|
Die Informationen aus dem URI für die empfohlenen Problembehandlungsaktionen.
|
TroubleshootingResult
Objekt
Problembehandlung für Informationen, die von der angegebenen Ressource gewonnen wurden.
Name |
Typ |
Beschreibung |
code
|
string
|
Der Ergebniscode der Problembehandlung.
|
endTime
|
string
|
Die Endzeit der Problembehandlung.
|
results
|
TroubleshootingDetails[]
|
Informationen aus der Problembehandlung.
|
startTime
|
string
|
Die Startzeit der Problembehandlung.
|