diff --git a/internal/services/apimanagement/api_management_api_diagnostic_resource.go b/internal/services/apimanagement/api_management_api_diagnostic_resource.go index 895f630fe5f8..7d1e9d3076b4 100644 --- a/internal/services/apimanagement/api_management_api_diagnostic_resource.go +++ b/internal/services/apimanagement/api_management_api_diagnostic_resource.go @@ -187,11 +187,14 @@ func resourceApiManagementApiDiagnosticCreateUpdate(d *pluginsdk.ResourceData, m parameters := apidiagnostic.DiagnosticContract{ Properties: &apidiagnostic.DiagnosticContractProperties{ - LoggerId: d.Get("api_management_logger_id").(string), - OperationNameFormat: pointer.To(apidiagnostic.OperationNameFormat(d.Get("operation_name_format").(string))), + LoggerId: d.Get("api_management_logger_id").(string), }, } + if d.Get("identifier") == "applicationinsights" { + parameters.Properties.OperationNameFormat = pointer.To(apidiagnostic.OperationNameFormat(d.Get("operation_name_format").(string))) + } + samplingPercentage := d.GetRawConfig().AsValueMap()["sampling_percentage"] if !samplingPercentage.IsNull() { parameters.Properties.Sampling = &apidiagnostic.SamplingSettings{