Policy Definitions - List By Management Group
擷取管理群組中的原則定義
此作業會擷取指定管理群組中符合選擇性指定$filter的所有原則定義清單。 $filter的有效值為:'atExactScope()'、'policyType -eq {value}' 或 'category eq '{value}''。 如果未提供$filter,未篩選的清單會包含與管理群組相關聯的所有原則定義,包括直接套用或從包含指定管理群組的管理群組。 如果提供 $filter=atExactScope() ,傳回的清單只會包含指定管理群組的所有原則定義。 如果提供 $filter='policyType -eq {value}' ,則傳回的列表只會包含類型符合 {value} 的所有原則定義。 可能的 policyType 值為 NotSpecified、BuiltIn、Custom 和 Static。 如果提供 $filter='category -eq {value}' ,則傳回的清單只會包含類別符合 {value} 的所有原則定義。
GET https://management.azure.com/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions?api-version=2023-04-01
GET https://management.azure.com/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions?api-version=2023-04-01&$filter={$filter}&$top={$top}
URI 參數
名稱 | 位於 | 必要 | 類型 | Description |
---|---|---|---|---|
management
|
path | True |
string |
管理群組的標識碼。 |
api-version
|
query | True |
string minLength: 1 |
要用於這項作業的 API 版本。 |
$filter
|
query |
string |
要套用至作業的篩選條件。 $filter的有效值為:'atExactScope()'、'policyType -eq {value}' 或 'category eq '{value}''。 如果未提供$filter,則不會執行任何篩選。 如果提供 $filter=atExactScope() ,則傳回的清單只會包含指定範圍內的所有原則定義。 如果提供 $filter='policyType -eq {value}' ,則傳回的列表只會包含類型符合 {value} 的所有原則定義。 可能的 policyType 值為 NotSpecified、BuiltIn、Custom 和 Static。 如果提供 $filter='category -eq {value}' ,則傳回的清單只會包含類別符合 {value} 的所有原則定義。 |
|
$top
|
query |
integer (int32) minimum: 1maximum: 1000 |
要傳回的記錄數目上限。 未提供$top篩選時,它會傳回 500 筆記錄。 |
回應
名稱 | 類型 | Description |
---|---|---|
200 OK |
確定 - 傳回原則定義的陣列。 |
|
Other Status Codes |
描述作業失敗原因的錯誤回應。 |
安全性
azure_auth
Azure Active Directory OAuth2 Flow。
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
名稱 | Description |
---|---|
user_impersonation | 模擬您的用戶帳戶 |
範例
List policy definitions by management group
範例要求
GET https://management.azure.com/providers/Microsoft.Management/managementGroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions?api-version=2023-04-01
範例回覆
{
"value": [
{
"properties": {
"mode": "All",
"displayName": "Allowed storage account SKUs",
"policyType": "BuiltIn",
"description": "This policy enables you to specify a set of storage account SKUs that your organization can deploy.",
"parameters": {
"listOfAllowedSKUs": {
"type": "Array",
"metadata": {
"description": "The list of SKUs that can be specified for storage accounts.",
"displayName": "Allowed SKUs",
"strongType": "StorageSKUs"
}
}
},
"version": "1.2.1",
"versions": [
"1.2.1",
"1.0.0"
],
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"not": {
"field": "Microsoft.Storage/storageAccounts/sku.name",
"in": "[parameters('listOfAllowedSKUs')]"
}
}
]
},
"then": {
"effect": "Deny"
}
}
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"type": "Microsoft.Authorization/policyDefinitions",
"name": "7433c107-6db4-4ad1-b57a-a76dce0154a1"
},
{
"id": "/providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"type": "Microsoft.Authorization/policyDefinitions",
"name": "ResourceNaming",
"properties": {
"mode": "All",
"displayName": "Naming Convention",
"description": "Force resource names to begin with 'prefix' and end with 'suffix'",
"metadata": {
"category": "Naming"
},
"version": "1.2.1",
"versions": [
"1.2.1",
"1.0.0"
],
"policyRule": {
"if": {
"not": {
"field": "name",
"like": "[concat(parameters('prefix'), '*', parameters('suffix'))]"
}
},
"then": {
"effect": "deny"
}
},
"parameters": {
"prefix": {
"type": "String",
"metadata": {
"displayName": "Prefix",
"description": "Resource name prefix"
}
},
"suffix": {
"type": "String",
"metadata": {
"displayName": "Suffix",
"description": "Resource name suffix"
}
}
},
"policyType": "Custom"
}
}
]
}
定義
名稱 | Description |
---|---|
Cloud |
原則作業的錯誤回應。 |
created |
建立資源的身分識別類型。 |
Error |
資源管理錯誤其他資訊。 |
Error |
錯誤回應 |
Metadata |
參數的一般元數據。 |
Parameter |
可提供給原則的參數定義。 |
parameter |
參數的數據類型。 |
Policy |
原則定義。 |
Policy |
原則定義清單。 |
policy |
原則定義的類型。 可能的值為 NotSpecified、BuiltIn、Custom 和 Static。 |
system |
與建立和上次修改資源相關的元數據。 |
CloudError
原則作業的錯誤回應。
名稱 | 類型 | Description |
---|---|---|
error |
錯誤回應 |
createdByType
建立資源的身分識別類型。
值 | Description |
---|---|
Application | |
Key | |
ManagedIdentity | |
User |
ErrorAdditionalInfo
資源管理錯誤其他資訊。
名稱 | 類型 | Description |
---|---|---|
info |
object |
其他資訊。 |
type |
string |
其他信息類型。 |
ErrorResponse
錯誤回應
名稱 | 類型 | Description |
---|---|---|
additionalInfo |
錯誤其他資訊。 |
|
code |
string |
錯誤碼。 |
details |
錯誤詳細數據。 |
|
message |
string |
錯誤訊息。 |
target |
string |
錯誤目標。 |
Metadata
參數的一般元數據。
名稱 | 類型 | Description |
---|---|---|
assignPermissions |
boolean |
設定為 true,讓 Azure 入口網站在原則指派期間,於此參數的資源標識碼或資源範圍值上建立角色指派。 如果您想要在指派範圍之外指派許可權,這個屬性就很有用。 |
description |
string |
參數的描述。 |
displayName |
string |
參數的顯示名稱。 |
strongType |
string |
透過入口網站指派原則定義時使用。 提供內容感知值清單,供用戶選擇。 |
ParameterDefinitionsValue
可提供給原則的參數定義。
名稱 | 類型 | Description |
---|---|---|
allowedValues |
object[] |
參數的允許值。 |
defaultValue |
object |
如果未提供任何值,則為 參數的預設值。 |
metadata |
參數的一般元數據。 |
|
schema |
object |
使用自我定義 JSON 架構,在指派期間提供參數輸入的驗證。 此屬性僅支持物件類型參數,並遵循架構 2019-09 實作 Json.NET。 您可以在 https://json-schema.org/ 深入瞭解如何使用架構,並在 https://www.jsonschemavalidator.net/測試草稿架構。 |
type |
參數的數據類型。 |
parameterType
參數的數據類型。
值 | Description |
---|---|
Array | |
Boolean | |
DateTime | |
Float | |
Integer | |
Object | |
String |
PolicyDefinition
原則定義。
名稱 | 類型 | 預設值 | Description |
---|---|---|---|
id |
string |
原則定義的標識碼。 |
|
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 |
#.#.# 格式的原則定義版本。 |
|
properties.versions |
string[] |
此原則定義的可用版本清單。 |
|
systemData |
與此資源相關的系統元數據。 |
||
type |
string |
資源的類型(Microsoft.Authorization/policyDefinitions)。 |
PolicyDefinitionListResult
原則定義清單。
名稱 | 類型 | Description |
---|---|---|
nextLink |
string |
要用於取得下一組結果的URL。 |
value |
原則定義的陣列。 |
policyType
原則定義的類型。 可能的值為 NotSpecified、BuiltIn、Custom 和 Static。
值 | Description |
---|---|
BuiltIn | |
Custom | |
NotSpecified | |
Static |
systemData
與建立和上次修改資源相關的元數據。
名稱 | 類型 | Description |
---|---|---|
createdAt |
string (date-time) |
資源建立的時間戳(UTC)。 |
createdBy |
string |
建立資源的身分識別。 |
createdByType |
建立資源的身分識別類型。 |
|
lastModifiedAt |
string (date-time) |
上次修改的資源時間戳 (UTC) |
lastModifiedBy |
string |
上次修改資源的身分識別。 |
lastModifiedByType |
上次修改資源的身分識別類型。 |