Server DevOps Audit Settings - Create Or Update

建立或更新伺服器的 DevOps 稽核設定。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/devOpsAuditingSettings/{devOpsAuditingSettingsName}?api-version=2021-11-01

URI 參數

名稱 位於 必要 類型 Description
devOpsAuditingSettingsName
path True

string

Devops 稽核設定的名稱。 這應該一律為 『default』。

resourceGroupName
path True

string

包含資源的資源群組名稱。 您可以從 Azure 資源管理員 API 或入口網站取得這個值。

serverName
path True

string

伺服器的名稱。

subscriptionId
path True

string

可識別 Azure 訂用帳戶的訂用帳戶識別碼。

api-version
query True

string

要用於要求的 API 版本。

要求本文

名稱 必要 類型 Description
properties.state True

BlobAuditingPolicyState

指定稽核的狀態。 如果 state 為 Enabled,則需要 storageEndpoint 或 isAzureMonitorTargetEnabled。

properties.isAzureMonitorTargetEnabled

boolean

指定 DevOps 稽核事件是否傳送至 Azure 監視器。 若要將事件傳送至 Azure 監視器,請將 'State' 指定為 'Enabled',並將 'IsAzureMonitorTargetEnabled' 指定為 true。

使用 REST API 來設定 DevOps 稽核時,也應該在 master 資料庫上建立具有 'DevOpsOperationsAudit' 診斷記錄類別的診斷設定。

診斷設定 URI 格式:PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

如需詳細資訊,請參閱 診斷設定 REST API診斷設定 PowerShell

properties.storageAccountAccessKey

string

指定稽核記憶體帳戶的標識碼金鑰。 如果狀態為 Enabled 且指定 storageEndpoint,則未指定 storageAccountAccessKey 將會使用 SQL Server 系統指派的受控識別來存取記憶體。 使用受控識別驗證的必要條件:

  1. 在 Azure Active Directory (AAD) 中指派系統指派的受控識別 SQL Server。
  2. 將「記憶體 Blob 數據參與者」RBAC 角色新增至伺服器識別,以授與 SQL Server 儲存器帳戶的身分識別存取權。 如需詳細資訊,請參閱 使用受控識別驗證稽核記憶體
properties.storageAccountSubscriptionId

string

指定 Blob 記憶體訂用帳戶標識碼。

properties.storageEndpoint

string

指定 blob 記憶體端點 (例如 https://MyAccount.blob.core.windows.net) 。 如果狀態為 Enabled,則需要 storageEndpoint 或 isAzureMonitorTargetEnabled。

回應

名稱 類型 Description
200 OK

ServerDevOpsAuditingSettings

已成功更新DevOps稽核設定。

202 Accepted

正在更新稽核 DevOps 設定。

Other Status Codes

錯誤回應: ≦

  • 400 InvalidServerDevOpsAuditSettingsCreateRequest - 建立伺服器 DevOps 稽核原則要求不存在或沒有 properties 物件。

  • 400 DataSecurityInvalidUserSuppliedParameter - 用戶端提供無效的參數值。

  • 400 InvalidServerDevOpsAuditSettingsName - 無效的伺服器 DevOps 原則名稱。

  • 400 DevOpsAuditInvalidStorageAccountCredentials - 提供的記憶體帳戶或存取密鑰無效。

  • 404 SubscriptionDoesNotHaveServer - 找不到要求的伺服器

  • 404 ServerNotInSubscriptionResourceGroup - 指定的伺服器不存在於指定的資源群組和訂用帳戶中。

  • 409 ServerDevOpsAuditSettingsInProgress - 設定伺服器 DevOps 稽核已在進行中。

範例

Update a server's DevOps audit settings with all params
Update a server's DevOps audit settings with minimal input

Update a server's DevOps audit settings with all params

範例要求

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/devAuditTestRG/providers/Microsoft.Sql/servers/devOpsAuditTestSvr/devOpsAuditingSettings/default?api-version=2021-11-01

{
  "properties": {
    "state": "Enabled",
    "storageAccountAccessKey": "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==",
    "storageEndpoint": "https://mystorage.blob.core.windows.net",
    "storageAccountSubscriptionId": "00000000-1234-0000-5678-000000000000",
    "isAzureMonitorTargetEnabled": true
  }
}

範例回覆

{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/devAuditTestRG/providers/Microsoft.Sql/servers/devOpsAuditTestSvr/devOpsAuditingSettings/default",
  "name": "default",
  "type": "Microsoft.Sql/servers/devOpsAuditingSettings",
  "properties": {
    "state": "Enabled",
    "storageEndpoint": "https://mystorage.blob.core.windows.net",
    "storageAccountSubscriptionId": "00000000-1234-0000-5678-000000000000",
    "isAzureMonitorTargetEnabled": true
  }
}

Update a server's DevOps audit settings with minimal input

範例要求

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/devAuditTestRG/providers/Microsoft.Sql/servers/devOpsAuditTestSvr/devOpsAuditingSettings/default?api-version=2021-11-01

{
  "properties": {
    "state": "Enabled",
    "storageAccountAccessKey": "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==",
    "storageEndpoint": "https://mystorage.blob.core.windows.net"
  }
}

範例回覆

{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/devAuditTestRG/providers/Microsoft.Sql/servers/devOpsAuditTestSvr/devOpsAuditingSettings/default",
  "name": "default",
  "type": "Microsoft.Sql/servers/devOpsAuditingSettings",
  "properties": {
    "state": "Enabled",
    "storageEndpoint": "https://mystorage.blob.core.windows.net",
    "storageAccountSubscriptionId": "00000000-1234-0000-5678-000000000000"
  }
}

定義

名稱 Description
BlobAuditingPolicyState

指定稽核的狀態。 如果 state 為 Enabled,則需要 storageEndpoint 或 isAzureMonitorTargetEnabled。

createdByType

建立資源的身分識別類型。

ServerDevOpsAuditingSettings

伺服器DevOps稽核設定。

systemData

與建立和上次修改資源相關的元數據。

BlobAuditingPolicyState

指定稽核的狀態。 如果 state 為 Enabled,則需要 storageEndpoint 或 isAzureMonitorTargetEnabled。

名稱 類型 Description
Disabled

string

Enabled

string

createdByType

建立資源的身分識別類型。

名稱 類型 Description
Application

string

Key

string

ManagedIdentity

string

User

string

ServerDevOpsAuditingSettings

伺服器DevOps稽核設定。

名稱 類型 Description
id

string

資源識別碼。

name

string

資源名稱。

properties.isAzureMonitorTargetEnabled

boolean

指定 DevOps 稽核事件是否傳送至 Azure 監視器。 若要將事件傳送至 Azure 監視器,請將 'State' 指定為 'Enabled',並將 'IsAzureMonitorTargetEnabled' 指定為 true。

使用 REST API 來設定 DevOps 稽核時,也應該在 master 資料庫上建立具有 'DevOpsOperationsAudit' 診斷記錄類別的診斷設定。

診斷設定 URI 格式:PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

如需詳細資訊,請參閱 診斷設定 REST API診斷設定 PowerShell

properties.state

BlobAuditingPolicyState

指定稽核的狀態。 如果 state 為 Enabled,則需要 storageEndpoint 或 isAzureMonitorTargetEnabled。

properties.storageAccountAccessKey

string

指定稽核記憶體帳戶的標識碼金鑰。 如果狀態為 Enabled 且指定 storageEndpoint,則未指定 storageAccountAccessKey 將會使用 SQL Server 系統指派的受控識別來存取記憶體。 使用受控識別驗證的必要條件:

  1. 在 Azure Active Directory (AAD) 中指派系統指派的受控識別 SQL Server。
  2. 將「記憶體 Blob 數據參與者」RBAC 角色新增至伺服器識別,以授與 SQL Server 儲存器帳戶的身分識別存取權。 如需詳細資訊,請參閱 使用受控識別驗證稽核記憶體
properties.storageAccountSubscriptionId

string

指定 Blob 記憶體訂用帳戶標識碼。

properties.storageEndpoint

string

指定 blob 記憶體端點 (例如 https://MyAccount.blob.core.windows.net) 。 如果狀態為 Enabled,則需要 storageEndpoint 或 isAzureMonitorTargetEnabled。

systemData

systemData

ServerDevOpsAuditSettingsResource 的 SystemData。

type

string

資源類型。

systemData

與建立和上次修改資源相關的元數據。

名稱 類型 Description
createdAt

string

資源建立的時間戳 (UTC) 。

createdBy

string

建立資源的身分識別。

createdByType

createdByType

建立資源的身分識別類型。

lastModifiedAt

string

上次修改的資源時間戳 (UTC)

lastModifiedBy

string

上次修改資源的身分識別。

lastModifiedByType

createdByType

上次修改資源的身分識別類型。