Skip to content

Commit

Permalink
Merge pull request #187 from ElYusubov/development
Browse files Browse the repository at this point in the history
Minor updates to the tagging policy bicep file
  • Loading branch information
ElYusubov authored Nov 2, 2024
2 parents ea4381b + 761bd59 commit c6dd19e
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tagging-policies/audit-resourcegroup-tag.bicep
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
// audit-resourcegroup-tag.bicep

// Set the scope of the deployment
targetScope = 'subscription'

// Set variables for the policy definition
var policyName = 'audit-resource-group-tag-pd'
var policyDisplayName = 'Audit a tag on resource groups'
var policyDescription = 'Audits existence of a tag. Does not apply to individual resources.'

// Create the policy definition
resource policy 'Microsoft.Authorization/policyDefinitions@2020-09-01' = {
name: policyName
properties: {
Expand All @@ -24,7 +29,6 @@ resource policy 'Microsoft.Authorization/policyDefinitions@2020-09-01' = {
}
}
}

policyRule: {
if: {
allOf: [
Expand All @@ -44,3 +48,21 @@ resource policy 'Microsoft.Authorization/policyDefinitions@2020-09-01' = {
}
}
}

// Create the policy assignment
resource policyAssignment 'Microsoft.Authorization/policyAssignments@2020-09-01' = {
name: '${policyName}-assignment'
properties: {
policyDefinitionId: policy.id
displayName: policyDisplayName
description: policyDescription
parameters: {
tagName: {
value: 'Environment'
}
tagPattern: {
value: 'Test'
}
}
}
}

0 comments on commit c6dd19e

Please sign in to comment.