Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the policy assignmentinto module and params #191

Merged
merged 2 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tagging-policies/audit-resource-tag-and-its-value-match.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,15 @@ resource policy 'Microsoft.Authorization/policyDefinitions@2020-09-01' = {
}
}
}

// Create the policy assignment
module policyAssignment 'audit-create-policy-assignment.bicep' = {
scope: resourceGroup() // investigate if this should be subscription
name: 'policyDeployment-${uniqueString(subscription().subscriptionId)}'
params: {
policyName: policyName
policyDisplayName: policyDisplayName
policyDescription: policyDescription
policyDefinitionId: policy.id
}
}
20 changes: 7 additions & 13 deletions tagging-policies/audit-resource-tag.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,13 @@ resource policy 'Microsoft.Authorization/policyDefinitions@2020-09-01' = {
}

// Create the policy assignment
resource policyAssignment 'Microsoft.Authorization/policyAssignments@2020-09-01' = {
name: '${policyName}-assignment'
properties: {
module policyAssignment 'audit-create-policy-assignment.bicep' = {
scope: resourceGroup() // investigate if this should be subscription
name: 'policyDeployment-${uniqueString(subscription().subscriptionId)}'
params: {
policyName: policyName
policyDisplayName: policyDisplayName
policyDescription: policyDescription
policyDefinitionId: policy.id
displayName: policyDisplayName
description: policyDescription
parameters: {
tagName: {
value: 'Environment'
}
tagPattern: {
value: 'Test'
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,13 @@ resource policy 'Microsoft.Authorization/policyDefinitions@2020-09-01' = {
}

// Create the policy assignment
resource policyAssignment 'Microsoft.Authorization/policyAssignments@2020-09-01' = {
name: '${policyName}-assignment'
properties: {
module policyAssignment 'audit-create-policy-assignment.bicep' = {
scope: resourceGroup() // investigate if this should be subscription
name: 'policyDeployment-${uniqueString(subscription().subscriptionId)}'
params: {
policyName: policyName
policyDisplayName: policyDisplayName
policyDescription: policyDescription
policyDefinitionId: policy.id
displayName: policyDisplayName
description: policyDescription
parameters: {
tagName: {
value: 'Environment'
}
tagPattern: {
value: 'Test'
}
}
}
}
20 changes: 7 additions & 13 deletions tagging-policies/audit-resourcegroup-tag-and-its-value-match.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,13 @@ resource policy 'Microsoft.Authorization/policyDefinitions@2020-09-01' = {
}

// Create the policy assignment
resource policyAssignment 'Microsoft.Authorization/policyAssignments@2020-09-01' = {
name: '${policyName}-assignment'
properties: {
module policyAssignment 'audit-create-policy-assignment.bicep' = {
scope: resourceGroup() // investigate if this should be subscription
name: 'policyDeployment-${uniqueString(subscription().subscriptionId)}'
params: {
policyName: policyName
policyDisplayName: policyDisplayName
policyDescription: policyDescription
policyDefinitionId: policy.id
displayName: policyDisplayName
description: policyDescription
parameters: {
tagName: {
value: 'Environment'
}
tagPattern: {
value: 'Test'
}
}
}
}
Loading