共用方式為


Server DevOps Audit Settings - Create Or Update

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

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

URI 參數

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

DevOpsAuditingSettingsName

resourceGroupName
path True

string

包含資源的資源群組名稱。 您可以從 Azure Resource Manager API 或入口網站取得此值。

serverName
path True

string

伺服器的名稱。

subscriptionId
path True

string

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

api-version
query True

string

要用於要求的 API 版本。

要求本文

名稱 必要 類型 Description
properties.state True

BlobAuditingPolicyState

指定稽核的狀態。 如果狀態為 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.isManagedIdentityInUse

boolean

指定受控識別是否用來存取 Blob 記憶體

properties.storageAccountAccessKey

string

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

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

string (uuid)

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

properties.storageEndpoint

string

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

回應

名稱 類型 Description
200 OK

ServerDevOpsAuditingSettings

已成功更新DevOps稽核設定。

202 Accepted

正在更新稽核 DevOps 設定。

標題

Location: string

Other Status Codes

ErrorResponse

錯誤回應: ***

  • 400 ManagedInstanceStoppingOrStopped - 實例處於停止/停止狀態時提交的衝突作業

  • 400 ManagedInstanceStarting - 實例處於啟動狀態時提交的衝突作業

  • 400 InvalidServerDevOpsAuditSettingsCreateRequest - 建立伺服器 DevOps 審核策略要求不存在或沒有任何屬性物件。

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

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

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

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

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

  • 404 OperationIdNotFound - 標識符為 的作業不存在。

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

  • 409 CannotCancelOperation - 管理作業處於無法取消的狀態。

  • 409 OperationCancelled - 使用者已取消作業。

  • 409 OperationInterrupted - 無法完成資源上的作業,因為相同資源上的另一個作業中斷。

  • 429 SubscriptionTooManyCreateUpdateRequests - 超出可用資源可處理之最大要求的要求。

  • 429 SubscriptionTooManyRequests - 超出可用資源可處理之最大要求的要求。

  • 500 OperationTimedOut - 作業逾時並自動回復。 請重試作業。

  • 503 TooManyRequests - 超出可用資源可處理之最大要求的要求。

範例

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=2023-08-01

{
  "properties": {
    "state": "Enabled",
    "storageAccountAccessKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "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=2023-08-01

{
  "properties": {
    "state": "Enabled",
    "storageAccountAccessKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "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

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

createdByType

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

DevOpsAuditingSettingsName
ErrorAdditionalInfo

資源管理錯誤其他資訊。

ErrorDetail

錯誤詳細數據。

ErrorResponse

錯誤回應

ServerDevOpsAuditingSettings

伺服器DevOps稽核設定。

systemData

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

BlobAuditingPolicyState

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

Description
Enabled
Disabled

createdByType

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

Description
User
Application
ManagedIdentity
Key

DevOpsAuditingSettingsName

Description
Default

ErrorAdditionalInfo

資源管理錯誤其他資訊。

名稱 類型 Description
info

object

其他資訊。

type

string

其他信息類型。

ErrorDetail

錯誤詳細數據。

名稱 類型 Description
additionalInfo

ErrorAdditionalInfo[]

錯誤其他資訊。

code

string

錯誤碼。

details

ErrorDetail[]

錯誤詳細數據。

message

string

錯誤訊息。

target

string

錯誤目標。

ErrorResponse

錯誤回應

名稱 類型 Description
error

ErrorDetail

error 物件。

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.isManagedIdentityInUse

boolean

指定受控識別是否用來存取 Blob 記憶體

properties.state

BlobAuditingPolicyState

指定稽核的狀態。 如果狀態為 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 (uuid)

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

properties.storageEndpoint

string

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

systemData

systemData

ServerDevOpsAuditSettingsResource 的 SystemData。

type

string

資源類型。

systemData

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

名稱 類型 Description
createdAt

string (date-time)

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

createdBy

string

建立資源的身分識別。

createdByType

createdByType

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

lastModifiedAt

string (date-time)

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

lastModifiedBy

string

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

lastModifiedByType

createdByType

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