Skip to content

Commit

Permalink
Explicitly model parameter definitions and values
Browse files Browse the repository at this point in the history
  • Loading branch information
pilor committed Oct 30, 2019
1 parent a91850e commit 02982f5
Show file tree
Hide file tree
Showing 10 changed files with 160 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
"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",
Expand All @@ -28,7 +37,7 @@
"policyDefinitionReferenceId": "Resource_Naming",
"parameters": {
"prefix": {
"value": "DeptA"
"value": "[parameters('namePrefix')]"
},
"suffix": {
"value": "-LC"
Expand All @@ -52,6 +61,15 @@
"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",
Expand All @@ -70,7 +88,7 @@
"policyDefinitionReferenceId": "Resource_Naming",
"parameters": {
"prefix": {
"value": "DeptA"
"value": "[parameters('namePrefix')]"
},
"suffix": {
"value": "-LC"
Expand All @@ -93,6 +111,15 @@
"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",
Expand All @@ -111,7 +138,7 @@
"policyDefinitionReferenceId": "Resource_Naming",
"parameters": {
"prefix": {
"value": "DeptA"
"value": "[parameters('namePrefix')]"
},
"suffix": {
"value": "-LC"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"groupNames": [ "CostSaving" ],
"groupNames": [
"CostSaving"
],
"parameters": {
"listOfAllowedSKUs": {
"value": [
Expand All @@ -39,7 +41,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"groupNames": [ "Organizational" ],
"groupNames": [
"Organizational"
],
"parameters": {
"prefix": {
"value": "DeptA"
Expand Down Expand Up @@ -82,7 +86,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"groupNames": [ "CostSaving" ],
"groupNames": [
"CostSaving"
],
"parameters": {
"listOfAllowedSKUs": {
"value": [
Expand All @@ -95,7 +101,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"groupNames": [ "Organizational" ],
"groupNames": [
"Organizational"
],
"parameters": {
"prefix": {
"value": "DeptA"
Expand Down Expand Up @@ -137,7 +145,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"groupNames": [ "CostSaving" ],
"groupNames": [
"CostSaving"
],
"parameters": {
"listOfAllowedSKUs": {
"value": [
Expand All @@ -150,7 +160,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"groupNames": [ "Organizational" ],
"groupNames": [
"Organizational"
],
"parameters": {
"prefix": {
"value": "DeptA"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"groupNames": [ "CostSaving" ],
"groupNames": [
"CostSaving"
],
"parameters": {
"listOfAllowedSKUs": {
"value": [
Expand All @@ -39,7 +41,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"groupNames": [ "Organizational" ],
"groupNames": [
"Organizational"
],
"parameters": {
"prefix": {
"value": "DeptA"
Expand Down Expand Up @@ -82,7 +86,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"groupNames": [ "CostSaving" ],
"groupNames": [
"CostSaving"
],
"parameters": {
"listOfAllowedSKUs": {
"value": [
Expand All @@ -95,7 +101,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"groupNames": [ "Organizational" ],
"groupNames": [
"Organizational"
],
"parameters": {
"prefix": {
"value": "DeptA"
Expand Down Expand Up @@ -137,7 +145,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"groupNames": [ "CostSaving" ],
"groupNames": [
"CostSaving"
],
"parameters": {
"listOfAllowedSKUs": {
"value": [
Expand All @@ -150,7 +160,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"groupNames": [ "Organizational" ],
"groupNames": [
"Organizational"
],
"parameters": {
"prefix": {
"value": "DeptA"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionReferenceId": "Limit_Skus",
"groupNames": [ "CostSaving" ],
"groupNames": [
"CostSaving"
],
"parameters": {
"listOfAllowedSKUs": {
"value": [
Expand All @@ -46,7 +48,9 @@
{
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"policyDefinitionReferenceId": "Resource_Naming",
"groupNames": [ "Organizational" ],
"groupNames": [
"Organizational"
],
"parameters": {
"prefix": {
"value": "DeptA"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/storageSkus",
"parameters": {
"allowedSkus": {
"type": "Array"
"value": "Standard_A1"
}
},
"scope": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/vmSkus",
"parameters": {
"allowedSkus": {
"type": "Array"
"value": "Standard_A1"
}
},
"scope": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"policyDefinitionId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/storageSkus",
"parameters": {
"allowedSkus": {
"type": "Array"
"value": "Standard_A1"
}
},
"scope": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,16 +566,16 @@
"description": "The policy's excluded scopes."
},
"parameters": {
"type": "object",
"description": "Required if a parameter is used in policy rule."
"description": "The parameter values for the assigned policy rule. The keys are the parameter names.",
"$ref": "#/definitions/ParameterValues"
},
"description": {
"type": "string",
"description": "This message will be part of response in case of policy violation."
},
"metadata": {
"type": "object",
"description": "The policy assignment metadata."
"description": "The policy assignment metadata. Metadata is an open ended object and is typically a collection of key value pairs."
},
"enforcementMode": {
"type": "string",
Expand All @@ -602,6 +602,19 @@
},
"description": "The policy assignment properties."
},
"ParameterValues": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"value": {
"description": "The value of the parameter.",
"type": "object"
}
}
},
"description": "The parameter values for the policy rule. The keys are the parameter names."
},
"PolicySku": {
"properties": {
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,15 +511,69 @@
},
"metadata": {
"type": "object",
"description": "The policy definition metadata."
"description": "The policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs."
},
"parameters": {
"type": "object",
"description": "Required if a parameter is used in policy rule."
"description": "The parameter definitions for parameters used in the policy rule. The keys are the parameter names.",
"$ref": "#/definitions/ParameterDefinitions"
}
},
"description": "The policy definition properties."
},
"ParameterDefinitions": {
"description": "The parameter definitions for parameters used in the policy. The keys are the parameter names.",
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"type": {
"description": "The data type of the parameter.",
"type": "string",
"enum": [
"String",
"Array",
"Object",
"Boolean",
"Integer",
"Float",
"DateTime"
],
"x-ms-enum": {
"name": "parameterType",
"modelAsString": true
}
},
"allowedValues": {
"type": "array",
"items": {
"type": "object"
},
"description": "The allowed values for the parameter."
},
"defaultValue": {
"type": "object",
"description": "The default value for the parameter if no value is provided."
},
"metadata": {
"type": "object",
"properties": {
"displayName": {
"type": "string",
"description": "The display name for the parameter."
},
"description": {
"type": "string",
"description": "The description of the parameter."
}
},
"additionalProperties": {
"type": "object"
},
"description": "General metadata for the parameter."
}
}
}
},
"PolicyDefinition": {
"properties": {
"properties": {
Expand Down
Loading

0 comments on commit 02982f5

Please sign in to comment.