你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az sql db threat-policy

此命令组已弃用,将在将来的版本中删除。 请改用“sql db advanced-threat-protection-setting”。

管理数据库的威胁检测策略。

命令

名称 说明 类型 状态
az sql db threat-policy show

获取威胁检测策略。

核心 已放弃
az sql db threat-policy update

更新数据库的威胁检测策略。

核心 已放弃

az sql db threat-policy show

已放弃

此命令已隐式弃用,因为命令组“sql db threat-policy”已弃用,将在将来的版本中删除。 请改用“sql db advanced-threat-protection-setting”。

获取威胁检测策略。

az sql db threat-policy show [--ids]
                             [--name]
                             [--resource-group]
                             [--server]
                             [--subscription]

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

Azure SQL 数据库的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--server -s

Azure SQL Server 的名称。 可以使用 < a0/a0> 配置默认值 az configure --defaults sql-server=<name>

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az sql db threat-policy update

已放弃

此命令已隐式弃用,因为命令组“sql db threat-policy”已弃用,将在将来的版本中删除。 请改用“sql db advanced-threat-protection-setting”。

更新数据库的威胁检测策略。

如果启用策略,则必须指定storage_account或同时storage_endpoint和storage_account_access_key。

az sql db threat-policy update [--add]
                               [--disabled-alerts]
                               [--email-account-admins]
                               [--email-addresses]
                               [--force-string]
                               [--ids]
                               [--name]
                               [--remove]
                               [--resource-group]
                               [--retention-days]
                               [--server]
                               [--set]
                               [--state {Disabled, Enabled, New}]
                               [--storage-account]
                               [--storage-endpoint]
                               [--storage-key]
                               [--subscription]

示例

按存储帐户名称启用。

az sql db threat-policy update -g mygroup -s myserver -n mydb \
    --state Enabled --storage-account mystorage

按存储终结点和密钥启用。

az sql db threat-policy update -g mygroup -s myserver -n mydb \
    --state Enabled --storage-endpoint https://mystorage.blob.core.windows.net \
    --storage-key MYKEY==

禁用警报类型的子集。

az sql db threat-policy update -g mygroup -s myserver -n mydb \
    --disabled-alerts Sql_Injection_Vulnerability Access_Anomaly

为策略配置电子邮件收件人。

az sql db threat-policy update -g mygroup -s myserver -n mydb \
    --email-addresses me@examlee.com you@example.com \
    --email-account-admins Enabled

禁用威胁策略。

az sql db threat-policy update -g mygroup -s myserver -n mydb --state Disabled

可选参数

--add

通过指定路径和键值对将对象添加到对象列表。 示例:--add property.listProperty <key=value, string or JSON string>

默认值: []
--disabled-alerts

已禁用的警报列表。

--email-account-admins

警报是否发送到帐户管理员。

--email-addresses

警报发送到的电子邮件地址列表。

--force-string

使用“set”或“add”时,保留字符串文本,而不是尝试转换为 JSON。

默认值: False
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

Azure SQL 数据库的名称。

--remove

从列表中删除属性或元素。 示例: --remove property.list <indexToRemove> OR --remove propertyToRemove.

默认值: []
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--retention-days

保留威胁检测日志的天数。

--server -s

Azure SQL Server 的名称。 可以使用 < a0/a0> 配置默认值 az configure --defaults sql-server=<name>

--set

通过指定要设置的属性路径和值来更新对象。 示例:--set property1.property2=<value>

默认值: []
--state

威胁检测策略状态。

接受的值: Disabled, Enabled, New
--storage-account

存储帐户的名称。

--storage-endpoint

存储帐户终结点。

--storage-key

存储帐户的访问密钥。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。