# Azure Sentinel (廃止)

{% hint style="danger" %}
MicrosoftはこのロギングAPIを非推奨としています。[Microsoft Sentinel](/enterprise-guide/jp/event-reporting/microsoft-sentinel/microsoft-sentinel-with-azure-marketplace.md)の統合の手順をご参照ください。
{% endhint %}

### 概要

Keeperは、Azure Sentinel / Log Analytics環境へのイベントストリーミングに対応しています。本ページでは、旧方式によるログストリーミング手順について説明しています。しかし、2025年に廃止が予定されておりますので、代わりに[Azure Monitor](/enterprise-guide/jp/event-reporting/microsoft-sentinel/azure-monitor.md)方式か[Azure Marketplace経由でのMicrosoft Sentinel連携](/enterprise-guide/jp/event-reporting/microsoft-sentinel/microsoft-sentinel-with-azure-marketplace.md)のご利用を推奨します。

この方式をセットアップするには、AzureでLog Analyticsワークスペースに移動し、**\[ワークスペース]** > **\[エージェント]** の順に選択します。ここで、ワークスペースのIDとキーを取得できます。選択したワークスペースへのログのストリーミングを開始するには、これらの2つのフィールドをKeeperに入力します。

![ワークスペースIDとキー](https://3468650114-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeJwa6ByNJ2qindnPknCW%2Fuploads%2Fm7S0hCzzrfVyAM4Jzmq3%2FJP_Azure_Agent.png?alt=media\&token=5bb1abca-1842-48ad-b7fb-5faf9833e6cc)

![Azure Sentinel/Log Analyticsの構成](https://3468650114-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeJwa6ByNJ2qindnPknCW%2Fuploads%2FwVMfk8LYN3weHFKQFUr8%2FJP_Azure.png?alt=media\&token=f3812c8e-12ef-4255-9be4-453a6d54887c)

Keeperから即座に、指定されたAzure Log Analyticsワークスペースに対して、イベントデータの送信を開始します。データは`Keeper_CL`というカスタムテーブルに格納されます。

ログを確認するには、**\[Log Analytics ワークスペース]** > **\[ログ]** を開き、`Keeper_CL`テーブルを選択します。

<figure><img src="https://3468650114-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeJwa6ByNJ2qindnPknCW%2Fuploads%2FOxioeHrzGPtRCruJGlZT%2Fimage.png?alt=media&#x26;token=4dbc9960-7239-45ab-bb50-3b2162776b64" alt=""><figcaption><p>Log Analytics ワークスペースのログ</p></figcaption></figure>

### トラブルシューティング

イベントログAPIのトラブルシューティングが必要な場合は、以下のPythonスクリプトを使用して、KeeperのバックエンドシステムがAzure環境にイベントログを送信する動作をシミュレートできます。テストの前に、Workspace IDとWorkspace Keyを実際の値に置き換えてください。

{% code lineNumbers="true" %}

```python
import base64
import datetime
import hmac
import hashlib
import requests
import json

# Configuration
workspace_id = 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx'
workspace_key = 'xxxxxx'
log_type = 'Keeper'

# Sample body
body = [
{
  "audit_event": "role_created",
  "remote_address": "11.22.33.44",
  "category": "policy",
  "client_version": "EMConsole.17.0.0",
  "username": "user@company.com",
  "enterprise_id": 6557,
  "timestamp": "2025-01-12T00:03:44.743Z",
  "role_id": "28162100560074"
},
{
  "audit_event": "role_enforcement_changed",
  "remote_address": "11.22.33.55",
  "category": "policy",
  "client_version": "EMConsole.17.0.0",
  "timestamp": "2025-01-13T00:03:44.743Z",
  "username": "user@company.com",
  "enterprise_id": 6557,
  "role_id": "28162100560074",
  "enforcement": "RESEND_ENTERPRISE_INVITE_IN_X_DAYS",
  "value": "7"
},
{
  "audit_event": "role_enforcement_changed",
  "remote_address": "11.22.33.66",
  "category": "policy",
  "client_version": "EMConsole.17.0.0",
  "timestamp": "2025-01-14T00:03:44.776Z",
  "username": "user@company.com",
  "enterprise_id": 6557,
  "role_id": "28162100560074",
  "enforcement": "SEND_BREACH_WATCH_EVENTS",
  "value": "ON"
},
{
  "audit_event": "role_enforcement_changed",
  "remote_address": "11.22.33.77",
  "category": "policy",
  "client_version": "EMConsole.17.0.0",
  "timestamp": "2025-01-15T00:03:44.835Z",
  "username": "user@company.com",
  "enterprise_id": 6557,
  "role_id": "28162100560074",
  "enforcement": "GENERATED_PASSWORD_COMPLEXITY",
  "value": "[{\"domains\":[\"_default_\"],\"length\":20,\"lower-use\":false,\"lower-min\":5}]"
},
{
  "audit_event": "audit_alert_sent",
  "category": "usage",
  "client_version": "Keeper Service.1.2.0",
  "username": "ALERT",
  "enterprise_id": 6557,
  "timestamp": "2025-01-16T01:31:11.123Z",
  "origin": "admin_permission_added",
  "name": "XXX123",
  "recipient": "user@company.com,+19165551212",
  "username_new": true,
  "client_version_new": true
}]

body_json = json.dumps(body)
method = 'POST'
content_type = 'application/json'
resource = '/api/logs'
rfc1123date = datetime.datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
content_length = len(body_json)

signature_string = f"{method}\n{content_length}\n{content_type}\nx-ms-date:{rfc1123date}\n{resource}"
decoded_key = base64.b64decode(workspace_key)
signature = base64.b64encode(hmac.new(decoded_key, signature_string.encode('utf-8'), hashlib.sha256).digest()).decode('utf-8')

headers = {
    'Content-Type': content_type,
    'Authorization': f'SharedKey {workspace_id}:{signature}',
    'Log-Type': log_type,
    'x-ms-date': rfc1123date
}

uri = f'https://{workspace_id}.ods.opinsights.azure.com/api/logs?api-version=2016-04-01'

response = requests.post(uri, data=body_json, headers=headers)
print(f"Response code: {response.status_code}")
print(f"Response message: {response.text}")
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/enterprise-guide/jp/event-reporting/microsoft-sentinel/azure-sentinel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
