Skip to content

Commit 7bc5c9a

Browse files
authored
Merge pull request #208226 from dlepow/dpai
[APIM] Update developer-portal-integrate-application-insights.md
2 parents cd95838 + 519114c commit 7bc5c9a

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

articles/api-management/developer-portal-integrate-application-insights.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ titleSuffix: Azure API Management
44
description: Learn how to integrate Application Insights into your managed or self-hosted developer portal.
55
author: dlepow
66
ms.author: danlep
7-
ms.date: 03/25/2021
7+
ms.date: 08/16/2022
88
ms.service: api-management
99
ms.topic: how-to
1010
---
@@ -18,7 +18,7 @@ A popular feature of Azure Monitor is Application Insights. It's an extensible A
1818
Follow these steps to plug Application Insights into your managed or self-hosted developer portal.
1919

2020
> [!IMPORTANT]
21-
> Steps 1 and 2 are not required for managed portals. If you have a managed portal, skip to step 4.
21+
> Steps 1 -3 are not required for managed portals. If you have a managed portal, skip to step 4.
2222
2323
1. Set up a [local environment](developer-portal-self-host.md#step-1-set-up-local-environment) for the latest release of the developer portal.
2424

@@ -28,23 +28,33 @@ Follow these steps to plug Application Insights into your managed or self-hosted
2828
npm install @paperbits/azure --save
2929
```
3030

31-
1. In the `startup.publish.ts` file in the `src` folder, import and register the Application Insights module:
31+
1. In the `startup.publish.ts` file in the `src` folder, import and register the Application Insights module. Add the `AppInsightsPublishModule` after the existing modules in the dependency injection container:
3232

3333
```typescript
3434
import { AppInsightsPublishModule } from "@paperbits/azure";
3535
...
36+
const injector = new InversifyInjector();
37+
injector.bindModule(new CoreModule());
38+
...
3639
injector.bindModule(new AppInsightsPublishModule());
40+
injector.resolve("autostart");
3741
```
3842

39-
1. Retrieve the portal's configuration:
43+
1. Retrieve the portal's configuration using the [Content Item - Get](/rest/api/apimanagement/current-ga/content-item/get) REST API:
4044

4145
```http
42-
GET /contentTypes/document/contentItems/configuration
46+
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.ApiManagement/service/{api-management-service-name}/contentTypes/document/contentItems/configuration?api-version=2021-08-01
4347
```
48+
49+
Output is similar to:
4450

4551
```json
4652
{
47-
"nodes": [
53+
"id": "/contentTypes/document/contentItems/configuration",
54+
"type": "Microsoft.ApiManagement/service/contentTypes/contentItems",
55+
"name": "configuration",
56+
"properties": {
57+
"nodes": [
4858
{
4959
"site": {
5060
"title": "Microsoft Azure API Management - developer portal",
@@ -55,17 +65,23 @@ Follow these steps to plug Application Insights into your managed or self-hosted
5565
}
5666
}
5767
]
68+
}
5869
}
5970
```
6071

61-
1. Extend the site configuration from the previous step with Application Insights configuration:
72+
1. Extend the site configuration from the previous step with Application Insights configuration. Update the configuration using the [Content Item - Create or Update](/rest/api/apimanagement/current-ga/content-item/create-or-update) REST API. Pass the Application Insights instrumentation key in an `integration` node in the request body.
73+
6274

6375
```http
64-
PUT /contentTypes/document/contentItems/configuration
76+
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.ApiManagement/service/{api-management-service-name}/contentTypes/document/contentItems/configuration?api-version=2021-08-01
6577
```
6678

6779
```json
6880
{
81+
"id": "/contentTypes/document/contentItems/configuration",
82+
"type": "Microsoft.ApiManagement/service/contentTypes/contentItems",
83+
"name": "configuration",
84+
"properties": {
6985
"nodes": [
7086
{
7187
"site": { ... },
@@ -76,9 +92,12 @@ Follow these steps to plug Application Insights into your managed or self-hosted
7692
}
7793
}
7894
]
95+
}
7996
}
8097
```
8198

99+
1. After you update the configuration, [republish the portal](api-management-howto-developer-portal-customize.md#publish) for the changes to take effect.
100+
82101
## Next steps
83102

84103
Learn more about the developer portal:

articles/api-management/developer-portal-integrate-google-tag-manager.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Follow the steps in this article to plug Google Tag Manager into your managed or
2020
Follow these steps to plug Google Tag Manager into your managed or self-hosted developer portal.
2121

2222
> [!IMPORTANT]
23-
> Steps 1 and 2 are not required for managed portals. If you have a managed portal, skip to step 4.
23+
> Steps 1 - 3 are not required for managed portals. If you have a managed portal, skip to step 4.
2424
2525
1. Set up a [local environment](developer-portal-self-host.md#step-1-set-up-local-environment) for the latest release of the developer portal.
2626

0 commit comments

Comments
 (0)