-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--------- Co-authored-by: Niclas Madsen <[email protected]>
- Loading branch information
Showing
9 changed files
with
287 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
policyDefinitions/Tags/validate-date-tag-on-subscription/azurepolicy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"name": "28e5394c-3122-4f50-a926-c7f168f0ebcc", | ||
"type": "Microsoft.Authorization/policyDefinitions", | ||
"properties": { | ||
"displayName": "Validate date tag on subscription", | ||
"description": "Validate a date tag on a subscription, e.g. ExpirationDate, in a YYYY-MM-DD format.", | ||
"metadata": { | ||
"version": "1.0.0", | ||
"category": "Tags" | ||
}, | ||
"mode": "All", | ||
"parameters": { | ||
"tagExpirationDate": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "tagExpirationDate", | ||
"description": "Name of the tag containing a date value." | ||
} | ||
}, | ||
"effect": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Deny, Audit or Disabled the execution of the Policy" | ||
}, | ||
"allowedValues": [ | ||
"Deny", | ||
"Audit", | ||
"Disabled" | ||
], | ||
"defaultValue": "Audit" | ||
} | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.Resources/subscriptions" | ||
}, | ||
{ | ||
"field": "[concat('tags[',parameters('tagExpirationDate'), ']')]", | ||
"notMatch": "####-##-##" | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
policyDefinitions/Tags/validate-date-tag-on-subscription/azurepolicy.parameters.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"tagExpirationDate": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "tagExpirationDate", | ||
"description": "Name of the tag containing a date value." | ||
} | ||
}, | ||
"effect": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Deny, Audit or Disabled the execution of the Policy" | ||
}, | ||
"allowedValues": [ | ||
"Deny", | ||
"Audit", | ||
"Disabled" | ||
], | ||
"defaultValue": "Audit" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
policyDefinitions/Tags/validate-date-tag-on-subscription/azurepolicy.rules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"if": { | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.Resources/subscriptions" | ||
}, | ||
{ | ||
"field": "[concat('tags[',parameters('tagExpirationDate'), ']')]", | ||
"notMatch": "####-##-##" | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
policyDefinitions/Tags/validate-email-tag-on-subscription/azurepolicy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"name": "151a7585-6199-43c8-887d-5f83dce26aa2", | ||
"type": "Microsoft.Authorization/policyDefinitions", | ||
"properties": { | ||
"displayName": "Validate email tag on subscription", | ||
"description": "Ensure subscription tag value for an email tag follows format *@domain.com.", | ||
"metadata": { | ||
"version": "1.0.0", | ||
"category": "Tags" | ||
}, | ||
"mode": "All", | ||
"parameters": { | ||
"tagEmail": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "tagEmail", | ||
"description": "Name of the tag containing the email address, e.g. 'SubOwner-Email'" | ||
} | ||
}, | ||
"tagValueEmailDomain": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "emailDomain", | ||
"description": "Enter the domain name of the email address, e.g. Accenture.com" | ||
} | ||
}, | ||
"effect": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Deny, Audit or Disabled the execution of the Policy" | ||
}, | ||
"allowedValues": [ | ||
"Deny", | ||
"Audit", | ||
"Disabled" | ||
], | ||
"defaultValue": "Audit" | ||
} | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.Resources/subscriptions" | ||
}, | ||
{ | ||
"field": "[concat('tags[',parameters('tagEmail'), ']')]", | ||
"notLike": "[concat('*@',parameters('tagValueEmailDomain'))]" | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
policyDefinitions/Tags/validate-email-tag-on-subscription/azurepolicy.parameters.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"tagEmail": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "tagEmail", | ||
"description": "Name of the tag containing the email address, e.g. 'SubOwner-Email'" | ||
} | ||
}, | ||
"tagValueEmailDomain": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "emailDomain", | ||
"description": "Enter the domain name of the email address, e.g. Accenture.com" | ||
} | ||
}, | ||
"effect": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Deny, Audit or Disabled the execution of the Policy" | ||
}, | ||
"allowedValues": [ | ||
"Deny", | ||
"Audit", | ||
"Disabled" | ||
], | ||
"defaultValue": "Audit" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
policyDefinitions/Tags/validate-email-tag-on-subscription/azurepolicy.rules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"if": { | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.Resources/subscriptions" | ||
}, | ||
{ | ||
"field": "[concat('tags[',parameters('tagEmail'), ']')]", | ||
"notLike": "[concat('*@',parameters('tagValueEmailDomain'))]" | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
policyDefinitions/Tags/validate-length-of-subscription-tag/azurepolicy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"name": "64b026ea-d1f4-429d-b580-8d41c760bece", | ||
"type": "Microsoft.Authorization/policyDefinitions", | ||
"properties": { | ||
"displayName": "Validate length of subscription tag", | ||
"description": "Validate the length of a subscription tag value.", | ||
"metadata": { | ||
"version": "1.0.0", | ||
"category": "Tags" | ||
}, | ||
"mode": "All", | ||
"parameters": { | ||
"tagCostCenter": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "tagCostCenter", | ||
"description": "Name of the tag, e.g. CostCenter" | ||
} | ||
}, | ||
"effect": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Deny, Audit or Disabled the execution of the Policy" | ||
}, | ||
"allowedValues": [ | ||
"Deny", | ||
"Audit", | ||
"Disabled" | ||
], | ||
"defaultValue": "Audit" | ||
} | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.Resources/subscriptions" | ||
}, | ||
{ | ||
"value": "[string(length(field(concat('tags[', parameters('tagCostCenter'), ']'))))]", | ||
"notEquals": "6" | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
policyDefinitions/Tags/validate-length-of-subscription-tag/azurepolicy.parameters.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"tagCostCenter": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "tagCostCenter", | ||
"description": "Name of the tag, e.g. CostCenter" | ||
} | ||
}, | ||
"effect": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Deny, Audit or Disabled the execution of the Policy" | ||
}, | ||
"allowedValues": [ | ||
"Deny", | ||
"Audit", | ||
"Disabled" | ||
], | ||
"defaultValue": "Audit" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
policyDefinitions/Tags/validate-length-of-subscription-tag/azurepolicy.rules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"if": { | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.Resources/subscriptions" | ||
}, | ||
{ | ||
"value": "[string(length(field(concat('tags[', parameters('tagCostCenter'), ']'))))]", | ||
"notEquals": "6" | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} |