Azure Private Link を介し、Azure Monitor に接続する

## 概念図
`VNet` の `Endpoint`経由で、`AMPLS`(Azure Monitor Private Link Scope)に接続し、`Log Analytics Workspace`に転送します。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/857b1ca5-578b-ea04-bcc9-6809c14d2163.png)

## 事前準備
[Azure VMの監視運用（準備編）](https://qiita.com/wwalpha/items/a727fd3e88e45193f41f)

## 主なステップ
- AMPLS の作成
- VNet の Private Endpoint の作成
- Azure Monitor の `Data Collection Rule` の作成
- `Data Collection Rule` の 監視対象の設定
- AMPLS の Azure Monitor Resource の設定
- Azure Monitor / Log Analytics Workspace の ネットワーク分離
- 結果確認

### AMPLS の作成
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/270aeccb-0e5d-c03c-f854-393e7f8dc995.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/33fd1d81-3457-b6db-6f2e-8cf8305ec143.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/e095d5bf-ff74-51ce-d988-866ad6b69dbd.png)

### VNet の Private Endpoint の作成
Azure コンソール上部に `Private Endpoints`で入力、`Private Endpoints` サービスをクリックする
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/cfca001f-60b0-3661-fafe-da8b5553852b.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/0b580cc5-f867-320f-bf3c-1a6d4046e7fd.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/3da78cd4-cd36-20c6-8499-bbcdc62529ee.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/5523f00e-d54a-c3ee-01a1-037adf5918eb.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/779bbcaf-d55f-e65f-23fe-77f827d2cc73.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/ef4dad0b-829c-f314-8979-c98aab4d4339.png)

### Azure Monitor の Data Collection Rule の作成
Azure Monitor のコンソール画面から操作します。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/0e79d19b-c036-8275-ec92-898681b16f7a.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/f6fb67a0-215d-9fe4-629a-f0b4b66632e3.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/2354193b-39b8-2709-a6da-641620137d95.png)
Windows Event ログの収集
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/5fdff040-3d53-a649-6423-2bda9082bbf2.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/444192ff-8f4a-a2d6-ec36-6e993fde3f7e.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/4cac9009-5270-89da-0f2d-a067cc4fde44.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/a9ac3ad5-3624-f18b-1327-6ce43cf47101.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/0ea842b9-b646-58ab-18bd-b4407908a1a4.png)

### Data Collection Rule の 監視対象の設定
Azure Monitor のコンソール画面から操作します。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/68098024-71af-5de4-b1dc-10fcd37c5b5a.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/12bd32e4-3472-8e59-b17f-34fe57cee25f.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/368771eb-9bb6-5133-0243-10d81d58d2f1.png)
Data Collection 用の Endpoint を作る
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/95ae6cb9-e60b-427b-e71c-776716900b98.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/11e19000-6b6d-6c80-471e-2ad9ce12c6e9.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/88406d74-fe35-5123-a89c-4cbec2475685.png)
作った`Endpoint`を選択し、保存する
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/cfaf91e5-0d93-fd9b-5c91-49c5b13ef1c1.png)

### AMPLS の Azure Monitor Resource の設定
AMPLS のコンソール画面から操作します。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/038c1f6c-74e5-a613-9149-f0535113d455.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/bf762b47-7316-36e8-ca3d-abc1230b5221.png)
`Log Analytics workspace` も追加する
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/6334f169-7164-0165-0860-c7f8f76f43b1.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/da4f454a-424a-2e2e-4e57-86108db6c2bd.png)
設定完了
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/d375b9b9-bcd2-63d0-78fb-70de258fdb72.png)

### Azure Monitor / Log Analytics Workspace の ネットワーク分離
Azure Monitor のコンソール画面から操作します。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/c7ffa00d-88c4-e370-e3c0-a4c7ec046243.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/a1dd37f5-1e72-5ae5-e54a-3be8e1374d72.png)
Log Analytics Workspaceのコンソール画面から操作します。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/94caf4b8-1302-056e-438d-4869a91ed8a3.png)

## 結果確認
OS の Performance Counter の情報が転送されています。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/1084ad10-09c5-da6b-d971-a13d85ac544c.png)
OS のログも転送されています。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/160072/d07ca32c-f61c-86f7-cb5a-bc28fc30cebc.png)