Microsoft.ApiManagement service/apis/diagnostics template reference

Template format

To create a Microsoft.ApiManagement/service/apis/diagnostics resource, add the following JSON to the resources section of your template.

{
  "name": "string",
  "type": "Microsoft.ApiManagement/service/apis/diagnostics",
  "apiVersion": "2019-01-01",
  "properties": {
    "alwaysLog": "allErrors",
    "loggerId": "string",
    "sampling": {
      "samplingType": "fixed",
      "percentage": "number"
    },
    "frontend": {
      "request": {
        "headers": [
          "string"
        ],
        "body": {
          "bytes": "integer"
        }
      },
      "response": {
        "headers": [
          "string"
        ],
        "body": {
          "bytes": "integer"
        }
      }
    },
    "backend": {
      "request": {
        "headers": [
          "string"
        ],
        "body": {
          "bytes": "integer"
        }
      },
      "response": {
        "headers": [
          "string"
        ],
        "body": {
          "bytes": "integer"
        }
      }
    },
    "enableHttpCorrelationHeaders": "boolean"
  }
}

Property values

The following tables describe the values you need to set in the schema.

Microsoft.ApiManagement/service/apis/diagnostics object

Name Type Required Value
name string Yes Diagnostic identifier. Must be unique in the current API Management service instance.
type enum Yes Microsoft.ApiManagement/service/apis/diagnostics
apiVersion enum Yes 2019-01-01
properties object Yes Diagnostic entity contract properties. - DiagnosticContractProperties object

DiagnosticContractProperties object

Name Type Required Value
alwaysLog enum No Specifies for what type of messages sampling settings should not apply. - allErrors
loggerId string Yes Resource Id of a target logger.
sampling object No Sampling settings for Diagnostic. - SamplingSettings object
frontend object No Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. - PipelineDiagnosticSettings object
backend object No Diagnostic settings for incoming/outgoing HTTP messages to the Backend - PipelineDiagnosticSettings object
enableHttpCorrelationHeaders boolean No Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true.

SamplingSettings object

Name Type Required Value
samplingType enum No Sampling type. - fixed
percentage number No Rate of sampling for fixed-rate sampling.

PipelineDiagnosticSettings object

Name Type Required Value
request object No Diagnostic settings for request. - HttpMessageDiagnostic object
response object No Diagnostic settings for response. - HttpMessageDiagnostic object

HttpMessageDiagnostic object

Name Type Required Value
headers array No Array of HTTP Headers to log. - string
body object No Body logging settings. - BodyDiagnosticSettings object

BodyDiagnosticSettings object

Name Type Required Value
bytes integer No Number of request body bytes to log.