説明
Azure は、リソースの作成、変更、削除などの管理操作をサブスクリプションのアクティビティログに 90 日間保持します。さらに長く保存する場合は、サブスクリプションの診断設定で必要なカテゴリをエクスポートしてください。
想定される影響
保存先でも早い段階で削除されると、後日の調査や監査で必要な変更履歴が欠けます。
対処方法
調査期間、契約・規制上の要件と保存コストから必要な期間を決めます。365 日は一例です。Log Analytics の保持期間か Storage のライフサイクルポリシーを設定し、調査担当者が最近の変更と必要な期間の古い記録を取得できることを確かめてください。
例
例で使う従来の Log Profile の廃止予定日は 2026 年 9 月 30 日でした。どちらのタスクにも実際のリソースグループ、ストレージアカウント、必要な権限を持つ認証情報が必要です。
変更前
yaml
- name: 로그 프로필 생성
azure_rm_monitorlogprofile:
name: myProfile
location: eastus
locations:
- eastus
- westus
categories:
- Write
- Action
retention_policy:
enabled: false
storage_account:
resource_group: myResourceGroup
name: myStorageAccount
enabled: false はプロファイルの有効期限を無効にします。アクティビティログの収集は継続します。
変更後
yaml
- name: 로그 프로필 생성
azure_rm_monitorlogprofile:
name: myProfile
location: eastus
locations:
- eastus
- westus
categories:
- Write
- Action
retention_policy:
enabled: true
days: 380
storage_account:
resource_group: myResourceGroup
name: myStorageAccount
このポリシーでは 380 日後に保持期限を迎えます。従来の形式で days: 0 は無期限の保持を表しますが、別の削除ポリシーは適用されます。