- 12 Jun 2024
- 2 Minutes to read
- Print
- DarkLight
- PDF
Creating a Policy Definition
- Updated on 12 Jun 2024
- 2 Minutes to read
- Print
- DarkLight
- PDF
Turbo360 allows users to define custom policy definitions. The Policy definition is a set of business rules described in JSON format.
Policy definition structure
The policy definition contains the following elements:
- Display name
- Description
- Category
- Mode
- Metadata
- Parameters
- Policy rule
Create a Policy definition
- Go to Policies section in Azure Documenter
- Click Create policy in the Definitions tab
- Define the policy scope. The scope can be either a management group or a subscription. Click Next
- Provide display name and description to identify the policy definition. The display name has a maximum length of 128 characters and the description has a maximum length of 512 characters
- Create or provide a built-in category to the policy definition. It is an optional field
The JSON field includes mode, parameters, and policy rule(s).
- Mode is configured depending on the policy if its targeting an Azure Resource Manager property or a Resource Provider property.
- Parameters help simplify your policy management by reducing the number of policy definitions. A parameter has the following properties that are used in the policy definition:
- name: The name of the parameter used by the parameters deployment function within the policy rule.
- type: Determines if the parameter is a string, array, object, boolean, integer, float, or datetime.
- metadata
Metadata has the following properties:
- description: The explanation of what the parameter is used for.
- displayName: A friendly name.
- strongType: Optional value, used to determine the type.
- assignPermissions: Optional value, set as true to create role assignments during policy assignment.
- defaultValue: Optional value, sets the value of the parameter in an assignment if no value is given. Required when updating an existing policy definition that is assigned. For object-type parameters, the value must match the appropriate schema.
- allowedValues: Optional value, provides an array of values that the parameter accepts during the assignment. Allowed value comparisons are case-sensitive. For object-type parameters, the values must match the appropriate schema.
- schema: Optional value, provides validation of parameter inputs during assignment using a self-defined JSON schema.
The policy rule consists of If and Then blocks. If a block contains one or more conditions that specify when the policy is enforced. Logical operators can be applied to these conditions to precisely define the scenario for a policy.
- Click Create to create the policy definition
During the creation or updating of a policy definition the name, description, and category are defined by properties external to the JSON.
Edit a Policy definition
- Click the Edit icon next to any policy definition in Policies -> Definitions
- Go through the same steps as in above for editing a policy definition and click Update
The scope of the policy definition cannot be changed when updating the policy definition.
Delete a Policy definition
- Click the Delete icon next to any policy definition in Policies -> Definitions
- Click Delete in the confirmation box
The built-in policy definition can't be edited or deleted.