Web Tests - Create Or Update

Crea o aggiorna una definizione di test Web di Application Insights.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}?api-version=2022-06-15

Parametri dell'URI

Nome In Necessario Tipo Descrizione
resourceGroupName
path True

string

minLength: 1
maxLength: 90

Nome del gruppo di risorse. Il nome non fa distinzione tra maiuscole e minuscole.

subscriptionId
path True

string

minLength: 1

ID della sottoscrizione di destinazione.

webTestName
path True

string

Nome della risorsa WebTest di Application Insights.

api-version
query True

string

minLength: 1

Versione dell'API da usare per questa operazione.

Corpo della richiesta

Nome Necessario Tipo Descrizione
location True

string

Percorso risorsa

properties.Kind True

WebTestKind

Il tipo di test Web è, le scelte valide sono ping, multistep e standard.

properties.Locations True

WebTestGeolocation[]

Elenco di dove eseguire fisicamente i test da per fornire una copertura globale per l'accessibilità dell'applicazione.

properties.Name True

string

Nome definito dall'utente se il test Web.

properties.SyntheticMonitorId True

string

ID univoco di questo test Web. Si tratta in genere dello stesso valore del campo Nome.

kind

WebTestKind

Tipo di test Web guardato da questo test Web. Le scelte sono ping, multistep e standard.

properties.Configuration

WebTestPropertiesConfiguration

Specifica di configurazione XML per un test Web.

properties.Description

string

Descrizione definita dall'utente per questo test Web.

properties.Enabled

boolean

Il test viene monitorato attivamente.

properties.Frequency

integer (int32)

Intervallo in secondi tra le esecuzioni dei test per questo test Web. Il valore predefinito è 300.

properties.Request

WebTestPropertiesRequest

Raccolta di proprietà della richiesta

properties.RetryEnabled

boolean

Consentire la ripetizione dei tentativi in caso di esito negativo del test Web.

properties.Timeout

integer (int32)

Secondi fino a quando il test Web non verrà timeout e avrà esito negativo. Il valore predefinito è 30.

properties.ValidationRules

WebTestPropertiesValidationRules

Raccolta di proprietà della regola di convalida

tags

object

Tag delle risorse

Risposte

Nome Tipo Descrizione
200 OK

WebTest

Operazione di aggiornamento 'WebTest' della risorsa riuscita

Sicurezza

azure_auth

Flusso OAuth2 di Azure Active Directory.

Tipo: oauth2
Flow: implicit
URL di autorizzazione: https://login.microsoftonline.com/common/oauth2/authorize

Ambiti

Nome Descrizione
user_impersonation rappresentare l'account utente

Esempio

webTestCreate
webTestCreateStandard
webTestUpdate

webTestCreate

Esempio di richiesta

PUT https://management.azure.com/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component?api-version=2022-06-15

{
  "kind": "ping",
  "location": "South Central US",
  "properties": {
    "Configuration": {
      "WebTest": "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"120\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"120\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>"
    },
    "Description": "Ping web test alert for mytestwebapp",
    "Enabled": true,
    "Frequency": 900,
    "Kind": "ping",
    "Locations": [
      {
        "Id": "us-fl-mia-edge"
      }
    ],
    "Name": "my-webtest-my-component",
    "RetryEnabled": true,
    "SyntheticMonitorId": "my-webtest-my-component",
    "Timeout": 120
  }
}

Risposta di esempio

{
  "name": "my-webtest-my-component",
  "type": "Microsoft.Insights/webtests",
  "id": "/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component",
  "kind": "ping",
  "location": "southcentralus",
  "properties": {
    "Configuration": {
      "WebTest": "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"120\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"120\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>"
    },
    "Description": "Ping web test alert for mytestwebapp",
    "Enabled": true,
    "Frequency": 900,
    "Kind": "ping",
    "Locations": [
      {
        "Id": "us-fl-mia-edge"
      }
    ],
    "Name": "my-webtest-my-component",
    "RetryEnabled": true,
    "SyntheticMonitorId": "my-webtest-my-component",
    "Timeout": 120,
    "provisioningState": "Succeeded"
  },
  "tags": {
    "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": "Resource"
  }
}

webTestCreateStandard

Esempio di richiesta

PUT https://management.azure.com/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component?api-version=2022-06-15

{
  "location": "South Central US",
  "properties": {
    "Description": "Ping web test alert for mytestwebapp",
    "Enabled": true,
    "Frequency": 900,
    "Kind": "standard",
    "Locations": [
      {
        "Id": "us-fl-mia-edge"
      }
    ],
    "Name": "my-webtest-my-component",
    "Request": {
      "Headers": [
        {
          "key": "Content-Language",
          "value": "de-DE"
        },
        {
          "key": "Accept-Language",
          "value": "de-DE"
        }
      ],
      "HttpVerb": "POST",
      "RequestBody": "SGVsbG8gd29ybGQ=",
      "RequestUrl": "https://bing.com"
    },
    "RetryEnabled": true,
    "SyntheticMonitorId": "my-webtest-my-component",
    "Timeout": 120,
    "ValidationRules": {
      "SSLCertRemainingLifetimeCheck": 100,
      "SSLCheck": true
    }
  }
}

Risposta di esempio

{
  "name": "my-webtest-my-component",
  "type": "Microsoft.Insights/webtests",
  "id": "/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component",
  "location": "southcentralus",
  "properties": {
    "Description": "Ping web test alert for mytestwebapp",
    "Enabled": true,
    "Frequency": 900,
    "Kind": "standard",
    "Locations": [
      {
        "Id": "us-fl-mia-edge"
      }
    ],
    "Name": "my-webtest-my-component",
    "Request": {
      "Headers": [
        {
          "key": "Content-Language",
          "value": "de-DE"
        },
        {
          "key": "Accept-Language",
          "value": "de-DE"
        }
      ],
      "HttpVerb": "POST",
      "RequestBody": "SGVsbG8gd29ybGQ=",
      "RequestUrl": "https://bing.com"
    },
    "RetryEnabled": true,
    "SyntheticMonitorId": "my-webtest-my-component",
    "Timeout": 120,
    "ValidationRules": {
      "SSLCertRemainingLifetimeCheck": 100,
      "SSLCheck": true
    },
    "provisioningState": "Succeeded"
  },
  "tags": {
    "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": "Resource"
  }
}

webTestUpdate

Esempio di richiesta

PUT https://management.azure.com/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component?api-version=2022-06-15

{
  "kind": "ping",
  "location": "South Central US",
  "properties": {
    "Configuration": {
      "WebTest": "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"30\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"30\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>"
    },
    "Frequency": 600,
    "Kind": "ping",
    "Locations": [
      {
        "Id": "us-fl-mia-edge"
      },
      {
        "Id": "apac-hk-hkn-azr"
      }
    ],
    "Name": "my-webtest-my-component",
    "SyntheticMonitorId": "my-webtest-my-component",
    "Timeout": 30
  }
}

Risposta di esempio

{
  "name": "my-webtest-my-component",
  "type": "Microsoft.Insights/webtests",
  "id": "/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component",
  "kind": "ping",
  "location": "southcentralus",
  "properties": {
    "Configuration": {
      "WebTest": "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"30\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"30\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>"
    },
    "Description": "Ping web test alert for mytestwebapp",
    "Enabled": true,
    "Frequency": 600,
    "Kind": "ping",
    "Locations": [
      {
        "Id": "us-fl-mia-edge"
      },
      {
        "Id": "apac-hk-hkn-azr"
      }
    ],
    "Name": "my-webtest-my-component",
    "RetryEnabled": true,
    "SyntheticMonitorId": "my-webtest-my-component",
    "Timeout": 30,
    "provisioningState": "Succeeded"
  },
  "tags": {
    "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": "Resource"
  }
}

Definizioni

Nome Descrizione
HeaderField

Intestazione da aggiungere al test Web.

WebTest

Definizione webTest di Application Insights.

WebTestGeolocation

Posizione geografica fisica da cui eseguire un webTest. È necessario specificare uno o più percorsi da cui eseguire il test.

WebTestKind

Tipo di test Web guardato da questo test Web. Le scelte sono ping, multistep e standard.

WebTestPropertiesConfiguration

Specifica di configurazione XML per un test Web.

WebTestPropertiesRequest

Raccolta di proprietà della richiesta

WebTestPropertiesValidationRules

Raccolta di proprietà della regola di convalida

WebTestPropertiesValidationRulesContentValidation

Raccolta di proprietà di convalida del contenuto

HeaderField

Intestazione da aggiungere al test Web.

Nome Tipo Descrizione
key

string

Nome dell'intestazione.

value

string

Valore dell'intestazione.

WebTest

Definizione webTest di Application Insights.

Nome Tipo Valore predefinito Descrizione
id

string

ID risorsa di Azure

kind

WebTestKind

ping

Tipo di test Web guardato da questo test Web. Le scelte sono ping, multistep e standard.

location

string

Percorso risorsa

name

string

Nome risorsa di Azure

properties.Configuration

WebTestPropertiesConfiguration

Specifica di configurazione XML per un test Web.

properties.Description

string

Descrizione definita dall'utente per questo test Web.

properties.Enabled

boolean

Il test viene monitorato attivamente.

properties.Frequency

integer (int32)

300

Intervallo in secondi tra le esecuzioni dei test per questo test Web. Il valore predefinito è 300.

properties.Kind

WebTestKind

ping

Il tipo di test Web è, le scelte valide sono ping, multistep e standard.

properties.Locations

WebTestGeolocation[]

Elenco di dove eseguire fisicamente i test da per fornire una copertura globale per l'accessibilità dell'applicazione.

properties.Name

string

Nome definito dall'utente se il test Web.

properties.Request

WebTestPropertiesRequest

Raccolta di proprietà della richiesta

properties.RetryEnabled

boolean

Consentire la ripetizione dei tentativi in caso di esito negativo del test Web.

properties.SyntheticMonitorId

string

ID univoco di questo test Web. Si tratta in genere dello stesso valore del campo Nome.

properties.Timeout

integer (int32)

30

Secondi fino a quando il test Web non verrà timeout e avrà esito negativo. Il valore predefinito è 30.

properties.ValidationRules

WebTestPropertiesValidationRules

Raccolta di proprietà della regola di convalida

properties.provisioningState

string

Stato corrente di questo componente, indipendentemente dal fatto che sia stato effettuato il provisioning all'interno del gruppo di risorse definito. Gli utenti non possono modificare questo valore, ma possono leggerlo. I valori includono Succeeded, Deploying, Canceled e Failed.

tags

object

Tag delle risorse

type

string

Tipo di risorsa di Azure

WebTestGeolocation

Posizione geografica fisica da cui eseguire un webTest. È necessario specificare uno o più percorsi da cui eseguire il test.

Nome Tipo Descrizione
Id

string

ID percorso da cui eseguire WebTest.

WebTestKind

Tipo di test Web guardato da questo test Web. Le scelte sono ping, multistep e standard.

Valore Descrizione
ping

ping

multistep

multistep

standard

standard

WebTestPropertiesConfiguration

Specifica di configurazione XML per un test Web.

Nome Tipo Descrizione
WebTest

string

Specifica XML di un webTest da eseguire su un'applicazione.

WebTestPropertiesRequest

Raccolta di proprietà della richiesta

Nome Tipo Descrizione
FollowRedirects

boolean

Seguire i reindirizzamenti per questo test Web.

Headers

HeaderField[]

Elenco di intestazioni e relativi valori da aggiungere alla chiamata WebTest.

HttpVerb

string

Verbo HTTP da usare per questo test Web.

ParseDependentRequests

boolean

Analizzare la richiesta dipendente per questo test Web.

RequestBody

string

Corpo della stringa con codifica Base64 da inviare con questo test Web.

RequestUrl

string

Percorso URL da testare.

WebTestPropertiesValidationRules

Raccolta di proprietà della regola di convalida

Nome Tipo Descrizione
ContentValidation

WebTestPropertiesValidationRulesContentValidation

Raccolta di proprietà di convalida del contenuto

ExpectedHttpStatusCode

integer (int32)

Verificare che WebTest restituisca il codice di stato http fornito.

IgnoreHttpStatusCode

boolean

Se impostata, la convalida ignorerà il codice di stato.

SSLCertRemainingLifetimeCheck

integer (int32)

Un numero di giorni per il controllo rimane ancora prima della scadenza del certificato SSL esistente. Il valore deve essere positivo e SSLCheck deve essere impostato su true.

SSLCheck

boolean

Verifica se il certificato SSL è ancora valido.

WebTestPropertiesValidationRulesContentValidation

Raccolta di proprietà di convalida del contenuto

Nome Tipo Descrizione
ContentMatch

string

Contenuto da cercare nella restituzione di WebTest. Non deve essere null o vuoto.

IgnoreCase

boolean

Se impostato, questo valore rende senza distinzione tra maiuscole e minuscole di convalida ContentMatch.

PassIfTextFound

boolean

Se true, la convalida passerà se esiste una corrispondenza per la stringa ContentMatch. Se false, la convalida avrà esito negativo se è presente una corrispondenza