Set-AzApiManagementDiagnostic

Modifies an API Management diagnostic at the Global or Api scope.

Syntax

Set-AzApiManagementDiagnostic
   -Context <PsApiManagementContext>
   -DiagnosticId <String>
   [-ApiId <String>]
   [-LoggerId <String>]
   [-AlwaysLog <String>]
   [-SamplingSetting <PsApiManagementSamplingSetting>]
   [-FrontEndSetting <PsApiManagementPipelineDiagnosticSetting>]
   [-BackendSetting <PsApiManagementPipelineDiagnosticSetting>]
   [-PassThru]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzApiManagementDiagnostic
   -InputObject <PsApiManagementDiagnostic>
   [-LoggerId <String>]
   [-AlwaysLog <String>]
   [-SamplingSetting <PsApiManagementSamplingSetting>]
   [-FrontEndSetting <PsApiManagementPipelineDiagnosticSetting>]
   [-BackendSetting <PsApiManagementPipelineDiagnosticSetting>]
   [-PassThru]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzApiManagementDiagnostic
   -ResourceId <String>
   [-LoggerId <String>]
   [-AlwaysLog <String>]
   [-SamplingSetting <PsApiManagementSamplingSetting>]
   [-FrontEndSetting <PsApiManagementPipelineDiagnosticSetting>]
   [-BackendSetting <PsApiManagementPipelineDiagnosticSetting>]
   [-PassThru]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The cmdlet Set-AzApiManagementDiagnostic updates the diagnostics which is configured at the Global or Api Scope.

Examples

Example 1: Modify a diagnostic at the Global scope

PS c:\> $context =New-AzApiManagementContext -ResourceGroupName Api-Default-WestUS -ServiceName contoso
PS c:\> $diagnostic=Get-AzApiManagementDiagnostic -Context $context -DiagnosticId "applicationinsights"
PS c:\> $diagnostic

DiagnosticId      : applicationinsights
AlwaysLog         : allErrors
LoggerId          : /subscriptions/subid/resourceGroups/Api-Default-WestUS/providers/Microsoft.ApiManagement/service/contoso/loggers/backendapisachinc
Sampling          : Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementSamplingSetting
Frontend          :
Backend           :
Id                : /subscriptions/subid/resourceGroups/Api-Default-WestUS/providers/Microsoft.ApiManagement/service/contoso/diagnostics/applicationinsights
ResourceGroupName : Api-Default-WestUS
ServiceName       : contoso


PS c:\> $diagnostic.Sampling

SamplingType Percentage
------------ ----------
fixed               100

PS c:\> $diagnostic.Sampling.Percentage = 50
PS c:\> $diagnostic.Sampling

SamplingType Percentage
------------ ----------
fixed                50

PS c:\> Set-AzApiManagementDiagnostic -InputObject $diagnostic

This command modifies the specified diagnostic Sampling Percentage from 100 to 50%

Example 2

Modifies an API Management diagnostic at the Global or Api scope. (autogenerated)

 
Set-AzApiManagementDiagnostic -AlwaysLog allErrors -ApiId '0001' -Context  -DiagnosticId 'applicationinsights' -LoggerId 'Logger123' -SamplingSetting 

Parameters

-AlwaysLog

Specifies for what type of messages sampling settings should not apply. This parameter is optional.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ApiId

Identifier of existing API. This parameter is optional.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-BackendSetting

Diagnostic setting for incoming/outgoing Http Messages to the Backend. This parameter is optional.

Type:Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementPipelineDiagnosticSetting
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Context

Instance of PsApiManagementContext. This parameter is required.

Type:PsApiManagementContext
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DiagnosticId

Identifier of existing Diagnostic. This parameter is required.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-FrontEndSetting

Diagnostic setting for incoming/outgoing Http Messages to the Gateway. This parameter is optional.

Type:Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementPipelineDiagnosticSetting
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-InputObject

Instance of PsApiManagementDiagnostic. This parameter is required.

Type:Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementDiagnostic
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-LoggerId

Identifier of the logger to push diagnostics to. This parameter is required.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-PassThru

If specified then instance of Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementDiagnostic type representing the set Diagnostic.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ResourceId

Arm ResourceId of Diagnostic or Api Diagnostic. This parameter is required.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-SamplingSetting

Sampling Setting of the Diagnostic. This parameter is optional.

Type:Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementSamplingSetting
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PsApiManagementContext

String

Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementDiagnostic

Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementSamplingSetting

Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementPipelineDiagnosticSetting

SwitchParameter

Outputs

Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementDiagnostic