Azure SQL監査ログの保持期間の確認

調査や監査に必要な期間、ログを保持してください。

説明

Azure SQL サーバーの Blob Storage 向け監査ポリシーでは、retention_in_days がログの保持日数を指定します。0 はこのポリシーで有効期限を設けない指定です。

想定される影響

保存先のログが早く削除されると、後から発覚したデータアクセスや変更を調べる記録が足りなくなる場合があります。

対処方法

調査・監査に必要な期間を設定してください。90 日を超える履歴が必要なら、その期間を満たす値を選びます。ストレージのライフサイクル規則で先に削除されないかを調べ、調査担当者が必要な時期の記録を読めることを確認します。

例

どちらのサーバー監査ポリシーも同じ Blob エンドポイントを使います。2 つ目の例は保持期間を 20 日から 95 日に延ばしています。本番では別途管理した管理者の認証情報を使用してください。

変更前

hcl
resource "azurerm_mssql_server" "example" {
  name                         = "sqlserver"
  resource_group_name          = azurerm_resource_group.example.name
  location                     = azurerm_resource_group.example.location
  version                      = "12.0"
  administrator_login          = "mradministrator"
  administrator_login_password = "thisIsDog11"

}

resource "azurerm_mssql_server_extended_auditing_policy" "example" {
  server_id = azurerm_mssql_server.example.id
  blob_storage_endpoint                        = azurerm_storage_account.example.primary_blob_endpoint
  storage_account_access_key              = azurerm_storage_account.example.primary_access_key
  storage_account_access_key_is_secondary = false
  retention_in_days                       = 20
}

変更後

hcl
resource "azurerm_mssql_server" "example" {
  name                         = "sqlserver"
  resource_group_name          = azurerm_resource_group.example.name
  location                     = azurerm_resource_group.example.location
  version                      = "12.0"
  administrator_login          = "mradministrator"
  administrator_login_password = "thisIsDog11"

}

resource "azurerm_mssql_server_extended_auditing_policy" "example" {
  server_id = azurerm_mssql_server.example.id
  blob_storage_endpoint                        = azurerm_storage_account.example.primary_blob_endpoint
  storage_account_access_key              = azurerm_storage_account.example.primary_access_key
  storage_account_access_key_is_secondary = false
  retention_in_days                       = 95
}

参考資料