你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Policy Definition Versions - List Built In
检索内置策略定义版本
此操作检索给定策略定义的所有内置策略定义版本的列表。
GET https://management.azure.com/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/versions?api-version=2023-04-01
GET https://management.azure.com/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/versions?api-version=2023-04-01&$top={$top}
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
policy
|
path | True |
string |
策略定义的名称。 Regex pattern: |
api-version
|
query | True |
string |
要用于此操作的 API 版本。 |
$top
|
query |
integer int32 |
要返回的最大记录数。 如果未提供$top筛选器,它将返回 500 条记录。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
正常 - 返回内置策略定义版本的数组。 |
|
Other Status Codes |
描述操作失败原因的错误响应。 |
安全性
azure_auth
Azure Active Directory OAuth2 Flow。
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名称 | 说明 |
---|---|
user_impersonation | 模拟用户帐户 |
示例
List built-in policy definition versions
Sample Request
Sample Response
{
"value": [
{
"properties": {
"mode": "All",
"displayName": "Audit SQL DB Level Audit Setting",
"policyType": "BuiltIn",
"description": "Audit DB level audit setting for SQL databases",
"parameters": {
"setting": {
"type": "String",
"metadata": {
"displayName": "Audit Setting"
},
"allowedValues": [
"enabled",
"disabled"
]
}
},
"version": "1.2.1",
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Sql/servers/databases"
},
"then": {
"effect": "AuditIfNotExists",
"details": {
"type": "Microsoft.Sql/servers/databases/auditingSettings",
"name": "default",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Sql/auditingSettings.state",
"equals": "[parameters('setting')]"
}
]
}
}
}
}
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/06a78e20-9358-41c9-923c-fb736d382a12/versions/1.2.1",
"type": "Microsoft.Authorization/policyDefinitions/versions",
"name": "1.2.1"
},
{
"properties": {
"mode": "All",
"displayName": "Audit SQL DB Level Audit Setting",
"policyType": "BuiltIn",
"description": "Audit DB level audit setting for SQL databases",
"parameters": {
"setting": {
"type": "String",
"metadata": {
"displayName": "Audit Setting"
},
"allowedValues": [
"enabled",
"disabled",
"default"
]
}
},
"version": "1.0.0",
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Sql/servers/databases"
},
"then": {
"effect": "AuditIfNotExists",
"details": {
"type": "Microsoft.Sql/servers/databases/auditingSettings",
"name": "default",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Sql/auditingSettings.state",
"equals": "[parameters('setting')]"
}
]
}
}
}
}
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/06a78e20-9358-41c9-923c-fb736d382a12/versions/1.0.0",
"type": "Microsoft.Authorization/policyDefinitions/versions",
"name": "1.0.0"
}
]
}
定义
名称 | 说明 |
---|---|
Cloud |
策略操作的错误响应。 |
created |
创建资源的标识类型。 |
Error |
资源管理错误附加信息。 |
Error |
错误响应 |
Metadata |
参数的常规元数据。 |
Parameter |
可提供给策略的参数的定义。 |
parameter |
参数的数据类型。 |
Policy |
策略定义版本的 ID。 |
Policy |
策略定义版本列表。 |
policy |
策略定义的类型。 可能的值为 NotSpecified、BuiltIn、Custom 和 Static。 |
system |
与资源的创建和上次修改相关的元数据。 |
CloudError
策略操作的错误响应。
名称 | 类型 | 说明 |
---|---|---|
error |
错误响应 |
createdByType
创建资源的标识类型。
名称 | 类型 | 说明 |
---|---|---|
Application |
string |
|
Key |
string |
|
ManagedIdentity |
string |
|
User |
string |
ErrorAdditionalInfo
资源管理错误附加信息。
名称 | 类型 | 说明 |
---|---|---|
info |
object |
其他信息。 |
type |
string |
其他信息类型。 |
ErrorResponse
错误响应
名称 | 类型 | 说明 |
---|---|---|
additionalInfo |
错误附加信息。 |
|
code |
string |
错误代码。 |
details |
错误详细信息。 |
|
message |
string |
错误消息。 |
target |
string |
错误目标。 |
Metadata
参数的常规元数据。
名称 | 类型 | 说明 |
---|---|---|
assignPermissions |
boolean |
设置为 true 以在策略分配期间Azure 门户此参数的资源 ID 或资源范围值创建角色分配。 如果希望在分配范围之外分配权限,此属性会很有用。 |
description |
string |
参数的说明。 |
displayName |
string |
参数的显示名称。 |
strongType |
string |
在通过门户分配策略定义时使用。 提供上下文感知值列表供用户选择。 |
ParameterDefinitionsValue
可提供给策略的参数的定义。
名称 | 类型 | 说明 |
---|---|---|
allowedValues |
object[] |
参数的允许值。 |
defaultValue |
object |
如果未提供值,则为 参数的默认值。 |
metadata |
参数的常规元数据。 |
|
schema |
object |
使用自定义的 JSON 架构在分配期间提供参数输入的验证。 此属性仅支持对象类型的参数,并遵循 Json.NET 架构 2019-09 实现。 可以了解更多关于在 https://json-schema.org/ 使用架构和在 https://www.jsonschemavalidator.net/ 测试草稿架构的信息。 |
type |
参数的数据类型。 |
parameterType
参数的数据类型。
名称 | 类型 | 说明 |
---|---|---|
Array |
string |
|
Boolean |
string |
|
DateTime |
string |
|
Float |
string |
|
Integer |
string |
|
Object |
string |
|
String |
string |
PolicyDefinitionVersion
策略定义版本的 ID。
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
id |
string |
策略定义版本的 ID。 |
|
name |
string |
策略定义版本的名称。 |
|
properties.description |
string |
策略定义说明。 |
|
properties.displayName |
string |
策略定义的显示名称。 |
|
properties.metadata |
object |
策略定义元数据。 元数据是一个开放式对象,通常是键值对的集合。 |
|
properties.mode |
string |
Indexed |
策略定义模式。 一些示例包括 All、Indexed、Microsoft.KeyVault.Data。 |
properties.parameters |
<string,
Parameter |
策略规则中使用的参数的参数定义。 键是参数名称。 |
|
properties.policyRule |
object |
策略规则。 |
|
properties.policyType |
策略定义的类型。 可能的值为 NotSpecified、BuiltIn、Custom 和 Static。 |
||
properties.version |
string |
采用 #.#.# 格式的策略定义版本。 |
|
systemData |
与此资源相关的系统元数据。 |
||
type |
string |
资源类型 (Microsoft.Authorization/policyDefinitions/versions) 。 |
PolicyDefinitionVersionListResult
策略定义版本列表。
名称 | 类型 | 说明 |
---|---|---|
nextLink |
string |
用于获取下一组结果的 URL。 |
value |
策略定义版本的数组。 |
policyType
策略定义的类型。 可能的值为 NotSpecified、BuiltIn、Custom 和 Static。
名称 | 类型 | 说明 |
---|---|---|
BuiltIn |
string |
|
Custom |
string |
|
NotSpecified |
string |
|
Static |
string |
systemData
与资源的创建和上次修改相关的元数据。
名称 | 类型 | 说明 |
---|---|---|
createdAt |
string |
资源的创建时间戳 (UTC) 。 |
createdBy |
string |
创建资源的标识。 |
createdByType |
创建资源的标识类型。 |
|
lastModifiedAt |
string |
资源上次修改的时间戳 (UTC) |
lastModifiedBy |
string |
上次修改资源的标识。 |
lastModifiedByType |
上次修改资源的标识类型。 |