Policy Set Definitions - Create Or Update
Bu işlem, verilen abonelikte belirtilen adla bir ilke kümesi tanımı oluşturur veya güncelleştirir.
PUT https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}?api-version=2023-04-01
URI Parametreleri
Name | İçinde | Gerekli | Tür | Description |
---|---|---|---|---|
policy
|
path | True |
string |
Oluşturulacak ilke kümesi tanımının adı. Regex pattern: |
subscription
|
path | True |
string uuid |
Hedef aboneliğin kimliği. Değer bir UUID olmalıdır. |
api-version
|
query | True |
string |
Bu işlem için kullanılacak API sürümü. |
İstek Gövdesi
Name | Gerekli | Tür | Description |
---|---|---|---|
properties.policyDefinitions | True |
İlke tanımı başvuru dizisi. |
|
properties.description |
string |
İlke kümesi tanım açıklaması. |
|
properties.displayName |
string |
İlke kümesi tanımının görünen adı. |
|
properties.metadata |
object |
İlke kümesi tanım meta verileri. Meta veriler açık uçlu bir nesnedir ve genellikle anahtar değer çiftlerinden oluşan bir koleksiyondur. |
|
properties.parameters |
<string,
Parameter |
İlke tanımı başvurularında kullanılabilecek ilke kümesi tanım parametreleri. |
|
properties.policyDefinitionGroups |
İlke tanımı gruplarını açıklayan meta veriler, ilke kümesi tanımı içinde başvurur. |
||
properties.policyType |
İlke kümesi tanımının türü. Olası değerler NotSpecified, BuiltIn, Custom ve Static değerleridir. |
||
properties.version |
string |
#.#.# biçiminde ilke kümesi tanım sürümü. |
|
properties.versions |
string[] |
Bu ilke kümesi tanımı için kullanılabilir sürümlerin listesi. |
Yanıtlar
Name | Tür | Description |
---|---|---|
200 OK |
Tamam - İlke kümesi tanımı hakkında bilgi döndürür. |
|
201 Created |
Oluşturuldu - İlke kümesi tanımı hakkındaki bilgileri döndürür. |
|
Other Status Codes |
İşlemin neden başarısız olduğunu açıklayan hata yanıtı. |
Güvenlik
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | kullanıcı hesabınızın kimliğine bürünme |
Örnekler
Create or update a policy set definition |
Create or update a policy set definition with groups |
Create or update a policy set definition
Sample Request
PUT https://management.azure.com/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement?api-version=2023-04-01
{
"properties": {
"displayName": "Cost Management",
"description": "Policies to enforce low cost storage SKUs",
"metadata": {
"category": "Cost Management"
},
"parameters": {
"namePrefix": {
"type": "String",
"defaultValue": "myPrefix",
"metadata": {
"displayName": "Prefix to enforce on resource names"
}
}
},
"policyDefinitions": [
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"parameters": {
"listOfAllowedSKUs": {
"value": [
"Standard_GRS",
"Standard_LRS"
]
}
}
},
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"parameters": {
"prefix": {
"value": "[parameters('namePrefix')]"
},
"suffix": {
"value": "-LC"
}
}
}
]
}
}
Sample Response
{
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement",
"type": "Microsoft.Authorization/policySetDefinitions",
"name": "CostManagement",
"properties": {
"displayName": "Cost Management",
"description": "Policies to enforce low cost storage SKUs",
"metadata": {
"category": "Cost Management"
},
"version": "1.2.1",
"versions": [
"1.2.1",
"1.0.0"
],
"parameters": {
"namePrefix": {
"type": "String",
"defaultValue": "myPrefix",
"metadata": {
"displayName": "Prefix to enforce on resource names"
}
}
},
"policyDefinitions": [
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"parameters": {
"listOfAllowedSKUs": {
"value": [
"Standard_GRS",
"Standard_LRS"
]
}
}
},
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"parameters": {
"prefix": {
"value": "[parameters('namePrefix')]"
},
"suffix": {
"value": "-LC"
}
}
}
]
}
}
{
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement",
"type": "Microsoft.Authorization/policySetDefinitions",
"name": "CostManagement",
"properties": {
"displayName": "Cost Management",
"description": "Policies to enforce low cost storage SKUs",
"metadata": {
"category": "Cost Management"
},
"parameters": {
"namePrefix": {
"type": "String",
"defaultValue": "myPrefix",
"metadata": {
"displayName": "Prefix to enforce on resource names"
}
}
},
"policyDefinitions": [
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"parameters": {
"listOfAllowedSKUs": {
"value": [
"Standard_GRS",
"Standard_LRS"
]
}
}
},
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"parameters": {
"prefix": {
"value": "[parameters('namePrefix')]"
},
"suffix": {
"value": "-LC"
}
}
}
]
}
}
Create or update a policy set definition with groups
Sample Request
PUT https://management.azure.com/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement?api-version=2023-04-01
{
"properties": {
"displayName": "Cost Management",
"description": "Policies to enforce low cost storage SKUs",
"metadata": {
"category": "Cost Management"
},
"policyDefinitionGroups": [
{
"name": "CostSaving",
"displayName": "Cost Management Policies",
"description": "Policies designed to control spend within a subscription."
},
{
"name": "Organizational",
"displayName": "Organizational Policies",
"description": "Policies that help enforce resource organization standards within a subscription."
}
],
"policyDefinitions": [
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"groupNames": [
"CostSaving"
],
"parameters": {
"listOfAllowedSKUs": {
"value": [
"Standard_GRS",
"Standard_LRS"
]
}
}
},
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"groupNames": [
"Organizational"
],
"parameters": {
"prefix": {
"value": "DeptA"
},
"suffix": {
"value": "-LC"
}
}
}
]
}
}
Sample Response
{
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement",
"type": "Microsoft.Authorization/policySetDefinitions",
"name": "CostManagement",
"properties": {
"displayName": "Cost Management",
"description": "Policies to enforce low cost storage SKUs",
"metadata": {
"category": "Cost Management"
},
"version": "1.2.1",
"versions": [
"1.2.1",
"1.0.0"
],
"policyDefinitionGroups": [
{
"name": "CostSaving",
"displayName": "Cost Management Policies",
"description": "Policies designed to control spend within a subscription."
},
{
"name": "Organizational",
"displayName": "Organizational Policies",
"description": "Policies that help enforce resource organization standards within a subscription."
}
],
"policyDefinitions": [
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"groupNames": [
"CostSaving"
],
"parameters": {
"listOfAllowedSKUs": {
"value": [
"Standard_GRS",
"Standard_LRS"
]
}
}
},
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"groupNames": [
"Organizational"
],
"parameters": {
"prefix": {
"value": "DeptA"
},
"suffix": {
"value": "-LC"
}
}
}
]
}
}
{
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement",
"type": "Microsoft.Authorization/policySetDefinitions",
"name": "CostManagement",
"properties": {
"displayName": "Cost Management",
"description": "Policies to enforce low cost storage SKUs",
"metadata": {
"category": "Cost Management"
},
"version": "1.2.1",
"versions": [
"1.2.1",
"1.0.0"
],
"policyDefinitionGroups": [
{
"name": "CostSaving",
"displayName": "Cost Management Policies",
"description": "Policies designed to control spend within a subscription."
},
{
"name": "Organizational",
"displayName": "Organizational Policies",
"description": "Policies that help enforce resource organization standards within a subscription."
}
],
"policyDefinitions": [
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"groupNames": [
"CostSaving"
],
"parameters": {
"listOfAllowedSKUs": {
"value": [
"Standard_GRS",
"Standard_LRS"
]
}
}
},
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"groupNames": [
"Organizational"
],
"parameters": {
"prefix": {
"value": "DeptA"
},
"suffix": {
"value": "-LC"
}
}
}
]
}
}
Tanımlar
Name | Description |
---|---|
Cloud |
İlke işleminden bir hata yanıtı. |
created |
Kaynağı oluşturan kimliğin türü. |
Error |
Kaynak yönetimi hatası ek bilgileri. |
Error |
Hata Yanıtı |
Metadata |
parametresi için genel meta veriler. |
Parameter |
İlkeye sağlanabilir bir parametrenin tanımı. |
parameter |
Parametrenin veri türü. |
Parameter |
Parametrenin değeri. |
Policy |
İlke tanımı grubu. |
Policy |
İlke tanımı başvurusu. |
Policy |
İlke kümesi tanımı. |
policy |
İlke kümesi tanımının türü. Olası değerler NotSpecified, BuiltIn, Custom ve Static değerleridir. |
system |
Kaynağın oluşturulması ve son değiştirilmesiyle ilgili meta veriler. |
CloudError
İlke işleminden bir hata yanıtı.
Name | Tür | Description |
---|---|---|
error |
Hata Yanıtı |
createdByType
Kaynağı oluşturan kimliğin türü.
Name | Tür | Description |
---|---|---|
Application |
string |
|
Key |
string |
|
ManagedIdentity |
string |
|
User |
string |
ErrorAdditionalInfo
Kaynak yönetimi hatası ek bilgileri.
Name | Tür | Description |
---|---|---|
info |
object |
Ek bilgiler. |
type |
string |
Ek bilgi türü. |
ErrorResponse
Hata Yanıtı
Name | Tür | Description |
---|---|---|
additionalInfo |
Hata ek bilgileri. |
|
code |
string |
Hata kodu. |
details |
Hata ayrıntıları. |
|
message |
string |
Hata iletisi. |
target |
string |
Hata hedefi. |
Metadata
parametresi için genel meta veriler.
Name | Tür | Description |
---|---|---|
assignPermissions |
boolean |
İlke ataması sırasında Azure portal bu parametrenin kaynak kimliğinde veya kaynak kapsamı değerinde rol atamaları oluşturmasını sağlamak için true olarak ayarlayın. Bu özellik, atama kapsamı dışında izinler atamak istemeniz durumunda kullanışlıdır. |
description |
string |
Parametresinin açıklaması. |
displayName |
string |
Parametrenin görünen adı. |
strongType |
string |
portal aracılığıyla ilke tanımı atanırken kullanılır. Kullanıcının aralarından seçim yapabileceğiniz değerlerin bağlam bilgisi olan bir listesi sağlar. |
ParameterDefinitionsValue
İlkeye sağlanabilir bir parametrenin tanımı.
Name | Tür | Description |
---|---|---|
allowedValues |
object[] |
parametresi için izin verilen değerler. |
defaultValue |
object |
Değer sağlanmazsa parametresinin varsayılan değeri. |
metadata |
parametresi için genel meta veriler. |
|
schema |
object |
Kendi kendine tanımlanmış bir JSON şeması kullanarak atama sırasında parametre girişlerinin doğrulanması sağlar. Bu özellik yalnızca nesne türü parametreler için desteklenir ve Json.NET Schema 2019-09 uygulamasını izler. şemaları kullanma hakkında daha fazla bilgiyi adresinden https://json-schema.org/ ve taslak şemaları https://www.jsonschemavalidator.net/test edebilirsiniz. |
type |
Parametrenin veri türü. |
parameterType
Parametrenin veri türü.
Name | Tür | Description |
---|---|---|
Array |
string |
|
Boolean |
string |
|
DateTime |
string |
|
Float |
string |
|
Integer |
string |
|
Object |
string |
|
String |
string |
ParameterValuesValue
Parametrenin değeri.
Name | Tür | Description |
---|---|---|
value |
object |
Parametre değeri. |
PolicyDefinitionGroup
İlke tanımı grubu.
Name | Tür | Description |
---|---|---|
additionalMetadataId |
string |
Grup hakkında ek meta veriler içeren bir kaynağın kaynak kimliği. |
category |
string |
Grubun kategorisi. |
description |
string |
Grubun açıklaması. |
displayName |
string |
Grubun görünen adı. |
name |
string |
Grubun adı. |
PolicyDefinitionReference
İlke tanımı başvurusu.
Name | Tür | Description |
---|---|---|
groupNames |
string[] |
Bu ilke tanımı başvurusunun ait olduğu grupların adı. |
parameters |
<string,
Parameter |
Başvuruda bulunan ilke kuralı için parametre değerleri. Anahtarlar parametre adlarıdır. |
policyDefinitionId |
string |
İlke tanımının veya ilke kümesi tanımının kimliği. |
policyDefinitionReferenceId |
string |
Bu ilke tanımı başvurusu için benzersiz bir kimlik (ilke kümesi tanımı içinde). |
PolicySetDefinition
İlke kümesi tanımı.
Name | Tür | Description |
---|---|---|
id |
string |
İlke kümesi tanımının kimliği. |
name |
string |
İlke kümesi tanımının adı. |
properties.description |
string |
İlke kümesi tanım açıklaması. |
properties.displayName |
string |
İlke kümesi tanımının görünen adı. |
properties.metadata |
object |
İlke kümesi tanım meta verileri. Meta veriler açık uçlu bir nesnedir ve genellikle anahtar değer çiftlerinden oluşan bir koleksiyondur. |
properties.parameters |
<string,
Parameter |
İlke tanımı başvurularında kullanılabilecek ilke kümesi tanım parametreleri. |
properties.policyDefinitionGroups |
İlke tanımı gruplarını açıklayan meta veriler, ilke kümesi tanımı içinde başvurur. |
|
properties.policyDefinitions |
İlke tanımı başvuru dizisi. |
|
properties.policyType |
İlke kümesi tanımının türü. Olası değerler NotSpecified, BuiltIn, Custom ve Static değerleridir. |
|
properties.version |
string |
#.#.# biçiminde ilke kümesi tanım sürümü. |
properties.versions |
string[] |
Bu ilke kümesi tanımı için kullanılabilir sürümlerin listesi. |
systemData |
Bu kaynakla ilgili sistem meta verileri. |
|
type |
string |
Kaynağın türü (Microsoft.Authorization/policySetDefinitions). |
policyType
İlke kümesi tanımının türü. Olası değerler NotSpecified, BuiltIn, Custom ve Static değerleridir.
Name | Tür | Description |
---|---|---|
BuiltIn |
string |
|
Custom |
string |
|
NotSpecified |
string |
|
Static |
string |
systemData
Kaynağın oluşturulması ve son değiştirilmesiyle ilgili meta veriler.
Name | Tür | Description |
---|---|---|
createdAt |
string |
Kaynak oluşturma (UTC) zaman damgası. |
createdBy |
string |
Kaynağı oluşturan kimlik. |
createdByType |
Kaynağı oluşturan kimliğin türü. |
|
lastModifiedAt |
string |
Kaynağın son değişikliğinin zaman damgası (UTC) |
lastModifiedBy |
string |
Kaynağı son değiştiren kimlik. |
lastModifiedByType |
Kaynağı en son değiştiren kimliğin türü. |