Edit

Share via


New-AzApiManagementLogger

Creates an API Management Logger.

Syntax

EventHubLoggerSet (Default)

New-AzApiManagementLogger
    -Context <PsApiManagementContext>
    -Name <String>
    -ConnectionString <String>
    [-LoggerId <String>]
    [-Description <String>]
    [-IsBuffered <Boolean>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ApplicationInsightsLoggerSet

New-AzApiManagementLogger
    -Context <PsApiManagementContext>
    -InstrumentationKey <String>
    [-LoggerId <String>]
    [-Description <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The New-AzApiManagementLogger cmdlet creates an Azure API Management Logger.

Examples

Example 1: Create a logger

$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
New-AzApiManagementLogger -Context $apimContext -LoggerId "Logger123" -Name "ContosoSdkEventHub" -ConnectionString "Endpoint=sb://ContosoSdkEventHubs.servicebus.windows.net/;SharedAccessKeyName=SendKey;SharedAccessKey=<key>" -Description "SDK event hub logger"

This command creates a logger named ContosoSdkEventHub by using the specified connection string.

Example 2

Creates an API Management Logger. (autogenerated)

New-AzApiManagementLogger -Context <PsApiManagementContext> -InstrumentationKey <String> -LoggerId 'Logger123'

Parameters

-ConnectionString

Specifies an Azure Event Hubs connection string that starts with the following: Endpoint=endpoint and key from Azure classic portal The Key with Send Rights in the connection string must be configured.

Parameter properties

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

Parameter sets

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

-Context

Specifies a PsApiManagementContext object.

Parameter properties

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

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
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

-Description

Specifies a description.

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

-InstrumentationKey

Instrumentation Key of the application Insights. This parameter is optional.

Parameter properties

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

Parameter sets

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

-IsBuffered

Specifies whether the records in the logger are buffered before publishing. The default value is $True. When records are buffered, they are sent to Event Hubs every 15 seconds, or whenever the buffer receives 256 KB of messages.

Parameter properties

Type:

Nullable<T>[Boolean]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-LoggerId

Specifies an ID for the logger. If you do not specify an ID, this cmdlet generates one.

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

-Name

Specifies the entity name of an event hub from Azure classic portal.

Parameter properties

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

Parameter sets

EventHubLoggerSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
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

Nullable<T>

Outputs

PsApiManagementLogger