Get-AzApiManagementDiagnostic
Get details of the Diagnostic configured at the service level or the Api Level. Diagnostics are used to log requests/responses from Api Management gateway.
Syntax
ContextParameterSet (Default)
Get-AzApiManagementDiagnostic
-Context <PsApiManagementContext>
[-DiagnosticId <String>]
[-ApiId <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ResourceIdParameterSet
Get-AzApiManagementDiagnostic
-ResourceId <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Get-AzApiManagementDiagnostic gets details of the diagnostics configured in the Api management service at a given scope.
Examples
Example 1: Get all the diagnostic configured at the tenant scope.
$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Get-AzApiManagementDiagnostic -Context $apimContext
DiagnosticId : applicationinsights
ApiId :
AlwaysLog : allErrors
LoggerId : backendapisachinc
EnableHttpCorrelationHeaders : True
SamplingSetting : Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementSamplingSetting
FrontendSetting :
BackendSetting :
Id : /subscriptions/subid/resourceGroups/Api-Default-WestUS/providers/Microsoft.ApiManagement/service/contoso/diagnostics/applicationinsights
ResourceGroupName : Api-Default-WestUS
ServiceName : contoso
DiagnosticId : azuremonitor
ApiId :
AlwaysLog :
LoggerId : azuremonitor
EnableHttpCorrelationHeaders :
SamplingSetting : Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementSamplingSetting
FrontendSetting :
BackendSetting :
Id : /subscriptions/subid/resourceGroups/Api-Default-WestUS/providers/Microsoft.ApiManagement/service/contoso/diagnostics/azuremonitor
ResourceGroupName : Api-Default-WestUS
ServiceName : contoso
This command gets all the diagnostics configured in the Api Management service.
Example 2: Get all the diagnostics configured at the Api scope
$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Get-AzApiManagementDiagnostic -Context $apimContext -ApiId "echo-api"
DiagnosticId : applicationinsights
ApiId : echo-api
AlwaysLog : allErrors
LoggerId : backendapisachinc
EnableHttpCorrelationHeaders : True
SamplingSetting : Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementSamplingSetting
FrontendSetting : Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementPipelineDiagnosticSetting
BackendSetting : Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementPipelineDiagnosticSetting
Id : /subscriptions/subid/resourceGroups/Api-Default-WestUS/providers/Microsoft.ApiManagement/service/contoso/apis/echo-api/diagnostics/applicationinsights
ResourceGroupName : Api-Default-WestUS
ServiceName : contoso
This command gets all the diagnostics configured at the echo-api
Api scope
Example 3: Get the API-scope diagnostic specified by an Id
$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Get-AzApiManagementDiagnostic -Context $apimContext -ApiId "echo-api" -DiagnosticId "applicationinsights"
DiagnosticId : applicationinsights
ApiId : echo-api
AlwaysLog : allErrors
LoggerId : backendapisachinc
EnableHttpCorrelationHeaders : True
SamplingSetting : Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementSamplingSetting
FrontendSetting :
BackendSetting :
Id : /subscriptions/subid/resourceGroups/Api-Default-WestUS/providers/Microsoft.ApiManagement/service/contoso/diagnostics/applicationinsights
ResourceGroupName : Api-Default-WestUS
ServiceName : contoso
This command gets the applicationinsights
diagnostics configured in api echo-api
.
Parameters
-ApiId
Identifier of existing API. If specified will return API-scope diagnostic. This parameters is required.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ContextParameterSet
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
ContextParameterSet
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. If specified will return product-scope policy. This parameters is optional.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ContextParameterSet
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-ResourceId
Arm Resource Identifier of a Diagnostic or Api Diagnostic. If specified will try to find diagnostic by the identifier. This parameter is required.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ResourceIdParameterSet
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.