Redigera

Dela via


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

$context =New-AzApiManagementContext -ResourceGroupName Api-Default-WestUS -ServiceName contoso
$diagnostic=Get-AzApiManagementDiagnostic -Context $context -DiagnosticId "applicationinsights"
$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


$diagnostic.Sampling

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

$diagnostic.Sampling.Percentage = 50
$diagnostic.Sampling

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

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 <PsApiManagementContext> -DiagnosticId 'applicationinsights' -LoggerId 'Logger123' -SamplingSetting <PsApiManagementSamplingSetting>

Parameters

-AlwaysLog

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

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

-ApiId

Identifier of existing API. This parameter is optional.

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

-BackendSetting

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

Type:PsApiManagementPipelineDiagnosticSetting
Position:Named
Default value:None
Required:False
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Context

Instance of PsApiManagementContext. This parameter is required.

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

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DiagnosticId

Identifier of existing Diagnostic. This parameter is required.

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

-FrontEndSetting

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

Type:PsApiManagementPipelineDiagnosticSetting
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-InputObject

Instance of PsApiManagementDiagnostic. This parameter is required.

Type:PsApiManagementDiagnostic
Position:Named
Default value:None
Required:True
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
Required:False
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
Required:False
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
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SamplingSetting

Sampling Setting of the Diagnostic. This parameter is optional.

Type:PsApiManagementSamplingSetting
Position:Named
Default value:None
Required:False
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PsApiManagementContext

String

PsApiManagementDiagnostic

PsApiManagementSamplingSetting

PsApiManagementPipelineDiagnosticSetting

SwitchParameter

Outputs

PsApiManagementDiagnostic