Edit

Share via


Set-AzApiManagementDiagnostic

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

Syntax

ExpandedParameter (Default)

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

ByInputObject

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

ByResourceId

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ApiId

Identifier of existing API. This parameter is optional.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedParameter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-BackendSetting

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

Parameter properties

Type:PsApiManagementPipelineDiagnosticSetting
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Context

Instance of PsApiManagementContext. This parameter is required.

Parameter properties

Type:PsApiManagementContext
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedParameter
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DiagnosticId

Identifier of existing Diagnostic. This parameter is required.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedParameter
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-FrontEndSetting

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

Parameter properties

Type:PsApiManagementPipelineDiagnosticSetting
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-InputObject

Instance of PsApiManagementDiagnostic. This parameter is required.

Parameter properties

Type:PsApiManagementDiagnostic
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByInputObject
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-LoggerId

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PassThru

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceId

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-SamplingSetting

Sampling Setting of the Diagnostic. This parameter is optional.

Parameter properties

Type:PsApiManagementSamplingSetting
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

PsApiManagementContext

String

PsApiManagementDiagnostic

PsApiManagementSamplingSetting

PsApiManagementPipelineDiagnosticSetting

SwitchParameter

Outputs

PsApiManagementDiagnostic