你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Policy Exemptions - List For Resource
检索应用于资源的所有策略豁免。
此操作检索与给定资源组和订阅中与可选给定$filter匹配的指定资源关联的所有策略豁免列表。 $filter的有效值为:“atScope () ”、“atExactScope () ”、“excludeExpired () ”或“policyAssignmentId eq '{value}'”。 如果未提供$filter,则未筛选列表包括与资源关联的所有策略豁免,包括直接应用或从所有包含作用域应用的豁免,以及应用于资源中包含的资源的任何策略豁免。 三个参数加上资源名称用于标识特定资源。 如果资源不是父资源的一部分 (更常见的情况) ,则父资源路径不应 (提供或作为“”) 提供。 例如,可以将 Web 应用指定为 ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp') 。 如果资源是父资源的一部分,则应提供所有参数。 例如,虚拟机 DNS 名称可以指定为 ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName') 。 单独提供命名空间和类型名称的一种便捷替代方法是以 {resourceType} 参数格式提供: ({resourceProviderNamespace} == ''、{parentResourcePath} == ''、{resourceType} == 'Microsoft.Web/sites'、{resourceName} == 'MyWebApp') 。
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyExemptions?api-version=2022-07-01-preview
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyExemptions?$filter={$filter}&api-version=2022-07-01-preview
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
parent
|
path | True |
string |
父资源路径。 如果没有,请使用空字符串。 |
resource
|
path | True |
string |
包含资源的资源组的名称。 Regex pattern: |
resource
|
path | True |
string |
资源的名称。 |
resource
|
path | True |
string |
资源提供程序的命名空间。 例如,虚拟机的命名空间是 Microsoft.Compute/virtualMachines) 中的 Microsoft.Compute ( |
resource
|
path | True |
string |
资源类型名称。 例如,Web 应用的类型名称是 Microsoft.Web/sites) (的“sites”。 |
subscription
|
path | True |
string |
目标订阅的 ID。 |
api-version
|
query | True |
string |
要用于操作的 API 版本。 |
$filter
|
query |
string |
要应用于操作的筛选器。 $filter的有效值为:“atScope () ”、“atExactScope () ”、“excludeExpired () ”或“policyAssignmentId eq '{value}'”。 如果未提供$filter,则不执行筛选。 如果未提供$filter,则未筛选列表包括与范围关联的所有策略豁免,包括直接应用或从包含范围应用的策略豁免。 如果提供了 $filter=atScope () ,则返回的列表仅包括应用于范围的所有策略豁免,即未筛选列表中除应用于给定作用域中包含的子范围以外的所有策略豁免。 如果提供了 $filter=atExactScope () ,则返回的列表仅包括给定范围内的所有策略豁免。 如果提供了 $filter=excludeExpired () ,则返回的列表仅包括尚未过期或未设置到期日期的所有策略豁免。 如果$filter=policyAssignmentId eq“{value}”。 返回的列表仅包含与 give policyAssignmentId 关联的所有策略豁免。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
确定 - 返回策略豁免的数组。 |
|
Other Status Codes |
描述操作失败原因的错误响应。 |
安全性
azure_auth
Azure Active Directory OAuth2 流。
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名称 | 说明 |
---|---|
user_impersonation | 模拟用户帐户 |
示例
List all policy exemptions that apply to a resource
Sample Request
GET https://management.azure.com/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Compute/virtualMachines/MyTestVm/domainNames/MyTestComputer.cloudapp.net/providers/Microsoft.Authorization/policyExemptions?api-version=2022-07-01-preview
Sample Response
{
"value": [
{
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
}
},
"systemData": {
"createdBy": "string",
"createdByType": "User",
"createdAt": "2020-07-01T01:01:01.1075056Z",
"lastModifiedBy": "string",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-07-01T02:01:01.1075056Z"
},
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVMGroup",
"type": "Microsoft.Authorization/policyExemptions",
"name": "DemoExpensiveVMGroup"
},
{
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/LimitPorts",
"exemptionCategory": "Mitigated",
"displayName": "Exempt jump box open ports",
"description": "Exempt jump box open ports from limit ports policy",
"metadata": {
"reason": "Need to open RDP port to corp net"
}
},
"systemData": {
"createdBy": "string",
"createdByType": "User",
"createdAt": "2020-07-01T01:01:01.1075056Z",
"lastModifiedBy": "string",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-07-01T02:01:01.1075056Z"
},
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Compute/virtualMachines/MyTestVm/providers/Microsoft.Authorization/policyExemptions/jumpBoxExemption",
"type": "Microsoft.Authorization/policyExemptions",
"name": "jumpBoxExemption"
}
]
}
定义
名称 | 说明 |
---|---|
Assignment |
验证豁免是否在分配范围内或位于分配范围内的选项。 |
Cloud |
来自策略操作的错误响应。 |
created |
创建资源的标识类型。 |
Error |
资源管理错误附加信息。 |
Error |
错误响应 |
exemption |
策略豁免类别。 可能的值为“豁免”和“缓解”。 |
Policy |
策略豁免。 |
Policy |
策略豁免列表。 |
Resource |
用于按资源属性筛选策略的资源选择器。 |
Selector |
选择器表达式。 |
Selector |
选择器类型。 |
system |
与资源的创建和上次修改相关的元数据。 |
AssignmentScopeValidation
验证豁免是否在分配范围内或位于分配范围内的选项。
名称 | 类型 | 说明 |
---|---|---|
Default |
string |
此选项将验证豁免是否在分配范围或分配范围内。 |
DoNotValidate |
string |
此选项将绕过豁免范围在策略分配范围或策略分配范围下的验证。 |
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 |
错误目标。 |
exemptionCategory
策略豁免类别。 可能的值为“豁免”和“缓解”。
名称 | 类型 | 说明 |
---|---|---|
Mitigated |
string |
此类别的豁免通常意味着缓解操作已应用于范围。 |
Waiver |
string |
此类别的豁免通常意味着范围不适用于策略。 |
PolicyExemption
策略豁免。
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
id |
string |
策略豁免的 ID。 |
|
name |
string |
策略豁免的名称。 |
|
properties.assignmentScopeValidation | Default |
验证豁免是否在分配范围内或位于分配范围内的选项。 |
|
properties.description |
string |
策略豁免的说明。 |
|
properties.displayName |
string |
策略豁免的显示名称。 |
|
properties.exemptionCategory |
策略豁免类别。 可能的值为“豁免”和“缓解”。 |
||
properties.expiresOn |
string |
过期日期和时间 (UTC ISO 8601 格式,格式为 yyyy-MM-ddTHH:mm:ssZ,) 策略豁免。 |
|
properties.metadata |
object |
策略豁免元数据。 元数据是一个开放式对象,通常是键值对的集合。 |
|
properties.policyAssignmentId |
string |
要免除的策略分配的 ID。 |
|
properties.policyDefinitionReferenceIds |
string[] |
当关联的策略分配是策略集定义的分配时,策略定义引用 ID 列表。 |
|
properties.resourceSelectors |
用于按资源属性筛选策略的资源选择器列表。 |
||
systemData |
包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。 |
||
type |
string |
资源类型 (Microsoft.Authorization/policyExemptions) 。 |
PolicyExemptionListResult
策略豁免列表。
名称 | 类型 | 说明 |
---|---|---|
nextLink |
string |
用于获取下一组结果的 URL。 |
value |
策略豁免的数组。 |
ResourceSelector
用于按资源属性筛选策略的资源选择器。
名称 | 类型 | 说明 |
---|---|---|
name |
string |
资源选择器的名称。 |
selectors |
Selector[] |
选择器表达式的列表。 |
Selector
选择器表达式。
名称 | 类型 | 说明 |
---|---|---|
in |
string[] |
要筛选的值的列表。 |
kind |
选择器类型。 |
|
notIn |
string[] |
要筛选出的值的列表。 |
SelectorKind
选择器类型。
名称 | 类型 | 说明 |
---|---|---|
policyDefinitionReferenceId |
string |
用于按策略定义引用 ID 筛选策略的选择器类型。 |
resourceLocation |
string |
用于按资源位置筛选策略的选择器类型。 |
resourceType |
string |
用于按资源类型筛选策略的选择器类型。 |
resourceWithoutLocation |
string |
按不带位置的资源筛选策略的选择器类型。 |
systemData
与资源的创建和上次修改相关的元数据。
名称 | 类型 | 说明 |
---|---|---|
createdAt |
string |
资源创建时间戳 (UTC) 。 |
createdBy |
string |
创建资源的标识。 |
createdByType |
创建资源的标识类型。 |
|
lastModifiedAt |
string |
资源上次修改的时间戳 (UTC) |
lastModifiedBy |
string |
上次修改资源的标识。 |
lastModifiedByType |
上次修改资源的标识类型。 |