你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
New-AzApiManagementLogger
创建API 管理记录器。
语法
New-AzApiManagementLogger
-Context <PsApiManagementContext>
[-LoggerId <String>]
-Name <String>
-ConnectionString <String>
[-Description <String>]
[-IsBuffered <Boolean>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzApiManagementLogger
-Context <PsApiManagementContext>
[-LoggerId <String>]
-InstrumentationKey <String>
[-Description <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
New-AzApiManagementLogger cmdlet 创建 Azure API 管理记录器。
示例
示例 1:创建记录器
$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"
此命令使用指定的连接字符串创建名为 ContosoSdkEventHub 的记录器。
示例 2
创建API 管理记录器。 (自动生成)
New-AzApiManagementLogger -Context <PsApiManagementContext> -InstrumentationKey <String> -LoggerId 'Logger123'
参数
-ConnectionString
指定以以下内容开头的Azure 事件中心 连接字符串:Endpoint=endpoint and key from Azure classic portal
必须在连接字符串中配置具有发送权限的密钥。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Context
指定 PsApiManagementContext 对象。
类型: | PsApiManagementContext |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
类型: | IAzureContextContainer |
别名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Description
指定说明。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-InstrumentationKey
Application Insights 的检测密钥。 此参数是可选的。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-IsBuffered
指定在发布之前是否缓冲记录器中的记录。 默认值为$True。 缓冲记录时,每 15 秒或缓冲区接收 256 KB 的消息时,它们每 15 秒发送到事件中心。
类型: | Nullable<T>[Boolean] |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-LoggerId
指定记录器 ID。 如果未指定 ID,则此 cmdlet 将生成一个。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-Name
从 Azure 经典门户指定事件中心的实体名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
输入
Nullable<T>[[System.Boolean, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]