Standard deployment path
Structured quick-reference sections for prerequisites, installation, usage, and troubleshooting.
Prerequisites
- PowerShell 5.1+ with the Az module installed
- Authenticated Azure session via Connect-AzAccount
- Policy Contributor at the target management group or subscription scope
Recommended deployment path
- 1Run the script in WhatIf mode first to preview policy definition and assignment changes.
- 2Deploy in Audit mode to measure current tag compliance without blocking new resource groups.
- 3Switch to Deny mode after teams validate required tags and naming conventions.
# Preview changes first
./Deploy-EssentialTagsPolicy.ps1 -Scope Subscription -ScopeId "<subscription-id>" -WhatIf
# Start in audit mode
./Deploy-EssentialTagsPolicy.ps1 -Scope Subscription -ScopeId "<subscription-id>" -EnforcementMode AuditWhat this policy enforces
| Tag | Purpose | Typical values |
|---|---|---|
| Environment | Lifecycle and workload separation | Production, Development, Test, Staging |
| Owner | Accountability and incident routing | Team name or responsible owner |
| CostCenter | Chargeback/showback allocation | Business unit or finance code |
| Application | Workload identification | App/service name |
Compliance checks and troubleshooting
- Use Azure Policy compliance scans after deployment if results do not appear immediately.
- Policy evaluation can take time; allow up to ~30 minutes before concluding the assignment failed.
- Resource-level tagging is separate from resource-group enforcement unless you add inheritance or additional policies.
Get-AzPolicyAssignment -Name "essential-tags-policy"
Start-AzPolicyComplianceScanTest in Audit mode before enforcing Deny in production subscriptions to avoid blocking deployment pipelines unexpectedly.
Mise-en-Tag Enforcer for Azure
No enterprise bloat. No complex setup. Just tag enforcement that works. Deploy an Azure Policy that enforces essential tags on all resource groups in minutes.
Overview
The Mise-en-Tag Enforcer for Azure is a simple yet powerful tool that deploys an Azure Policy to enforce essential tags on all resource groups. This ensures proper governance, cost allocation, and resource management across your Azure environment without the complexity of enterprise-grade solutions.
This tool enforces four essential tags on all resource groups:
- Environment (Production, Development, Test, Staging)
- Owner (Team or individual responsible)
- CostCenter (For billing allocation)
- Application (Workload identification)
Features
Simple Deployment
Deploy in minutes with a single PowerShell command
Flexible Scope
Apply at management group or subscription level
Customizable Tags
Define your own set of required tags
Multiple Enforcement Modes
Choose between Deny, Audit, or Disabled
What-If Support
Preview changes before applying
Clear Reporting
Easy compliance checking via Azure Policy
Benefits
- Improved Cost Allocation: Accurately track and allocate costs by department, team, or project
- Enhanced Governance: Ensure all resource groups follow organizational standards
- Clear Ownership: Identify responsible teams or individuals for each resource group
- Simplified Management: Easily filter and organize resources by environment or application
Prerequisites
System Requirements
- PowerShell: Version 5.1 or later
- Azure PowerShell Module: Latest version installed
- Azure Authentication: User must be logged in with
Connect-AzAccount
Required Permissions
- Policy Contributor: Role at the target scope (management group or subscription)
Azure PowerShell Setup
# Install Azure PowerShell module (if not already installed)
Install-Module -Name Az -AllowClobber -Scope CurrentUser
# Login to Azure
Connect-AzAccount
# Verify access
Get-AzContextQuick Start (PowerShell - Recommended)
1. Download the Script
Download the script directly from GitHub or save it as Deploy-EssentialTagsPolicy.ps1
2. Deploy to Management Group
# Replace 'your-mg-id' with your management group ID
./Deploy-EssentialTagsPolicy.ps1 -Scope ManagementGroup -ScopeId"your-mg-id"3. Deploy to Subscription
# Replace 'your-subscription-id' with your subscription ID
./Deploy-EssentialTagsPolicy.ps1 -Scope Subscription -ScopeId"your-subscription-id"4. Test First (Recommended)
# Dry run to see what would happen
./Deploy-EssentialTagsPolicy.ps1 -Scope Subscription -ScopeId"your-subscription-id" -WhatIfManual Deployment (Azure Portal)
Step 1: Create Policy Definition
- Navigate to Azure Policy
Go to Azure Portal → Search"Policy" → Select"Policy"
- Create Definition
Click"Definitions" →"Policy definition" →"+ Policy definition"
- Fill in Details
- Definition location: Select your Management Group or Subscription
- Name:
require-essential-tags-resource-groups - Display name:
Require Essential Tags on Resource Groups - Category: Create new →
Governance
- Copy Policy Rule
Copy the entire content from
essential-tags-policy.jsonand paste into the"Policy rule" text boxClick"Save"
Step 2: Assign the Policy
- Create Assignment
Go to"Assignments" →"+ Assign policy"
- Assignment Details
- Scope: Select your Management Group or Subscription
- Policy definition: Search for"Require Essential Tags on Resource Groups"
- Assignment name:
essential-tags-policy
- Configure Parameters
- Effect: Choose"Deny" (or"Audit" for testing)
- Required Tags: Leave default or customize
- Review and Create
Click"Review + create" →"Create"
Usage Examples
Compliant Resource Groups
ALLOWS (Compliant Resource Group)
# Resource group with all required tags
az group create \
--name"myapp-prod-rg" \
--location"eastus" \
--tags Environment=Production Owner=platform-team CostCenter=engineering Application=web-appNon-Compliant Resource Groups
BLOCKS (Non-Compliant Resource Group)
# Missing tags - will be denied
az group create \
--name"random-rg" \
--location"eastus"
# ERROR: Resource group must have all required tagsCustomization Options
Custom Tags
You can customize which tags are required by modifying the RequiredTags parameter:
./Deploy-EssentialTagsPolicy.ps1 `
-Scope Subscription `
-ScopeId"your-subscription-id" `
-RequiredTags @("Environment","Owner","CostCenter","Application","SecurityContact")Enforcement Levels
| Effect | Description | When to Use |
|---|---|---|
Deny | Block non-compliant resources | Production enforcement (recommended) |
Audit | Report violations but allow creation | Initial testing and assessment |
Disabled | Turn off the policy | Temporary disabling during migrations |
Setting Audit Mode
Start with audit mode to see compliance without blocking:
./Deploy-EssentialTagsPolicy.ps1 `
-Scope Subscription `
-ScopeId"your-subscription-id" `
-Effect"Audit"Custom Assignment Name
You can customize the policy assignment name:
./Deploy-EssentialTagsPolicy.ps1 `
-Scope Subscription `
-ScopeId"your-subscription-id" `
-AssignmentName"my-custom-policy"Checking Compliance
PowerShell Method
# Check policy compliance
Get-AzPolicyState | Where-Object {$_.PolicyDefinitionName -eq"require-essential-tags-resource-groups"}Azure Portal Method
- Go to Azure Policy → Compliance
- Find your"Essential Tags Policy" assignment
- View compliant vs non-compliant resources
Troubleshooting
Common Issues
| Issue | Possible Cause | Resolution |
|---|---|---|
| "Access Denied" | Insufficient permissions | Ensure you have Policy Contributor role at the target scope |
| "Policy not taking effect" | Policy evaluation delay | Wait up to 30 minutes for evaluation cycle |
| "Tags not being enforced on resources" | Policy only targets resource groups | Enable tag inheritance or create separate policies for resources |
Debugging Commands
# Check your permissions
Get-AzRoleAssignment | Where-Object {$_.SignInName -eq (Get-AzContext).Account.Id}
# Validate policy assignment
Get-AzPolicyAssignment -Name"essential-tags-policy"
# Force policy evaluation (if needed)
Start-AzPolicyComplianceScanNext Steps
Recommended Follow-up Actions
- Enable Tag Inheritance
Apply resource group tags to child resources
- Set up Cost Allocation
Use tags in Azure Cost Management
- Automate Tag Application
Use Infrastructure as Code (Terraform/ARM)
- Create Tag Policies for Resources
Extend beyond resource groups
Expected Outcomes
After deployment, you should see:
- 100% of new resource groups have required tags
- Clear cost allocation in Azure Cost Management
- Easy resource identification and ownership
- Improved governance and compliance scores
CloudCostChefs Philosophy
We believe cloud cost optimization should be:
- Fast: Deploy in minutes, not months
- Practical: Real solutions for real problems
- Engineer-friendly: Code over clicks
- Immediately valuable: See results on day one
Ready to Enforce Essential Tags?
Download the Mise-en-Tag Enforcer for Azure and start implementing proper tagging governance today.
What to do next
Pick the path that fits where you are right now.