Implement and manage Azure Policy
Author and Group Azure Policies for Scalable Governance
Azure Policy enforces organizational standards by comparing resource properties to business rules written in JSON. Each rule is a policy definition that includes metadata, parameters, logical operators, property aliases, and a policy rule that determines what happens when a resource does not match the condition. To scale governance, you group multiple policy definitions into an initiative (also called a policySet). An initiative lets you assign a single object to track a broad goal such as regulatory compliance or cost management, and you can add or update policies inside the set without creating new assignments.
Policies and initiatives are assigned to specific scopes—management groups, subscriptions, or resource groups. A best practice is to define policies at higher levels in the hierarchy and assign them at child levels so that coverage is broad but management remains flexible. Each assignment can include parameters to make the definition reusable across environments, exclusions to skip specific sub-scopes from evaluation, and an enforcement mode that lets you test a policy’s impact without actually blocking resource creation.
The policy rule selects an effect that runs when a resource is non-compliant. Common effects are Deny (blocks the resource request), Audit (logs the event for later review), Modify (automatically changes resource properties), and DeployIfNotExists (deploys missing resources to bring the environment into compliance). Advanced effects like Modify or DeployIfNotExists require a managed identity with the correct RBAC permissions to perform the changes.
Treating Azure Policy as code means storing definitions in source control such as GitHub or Azure DevOps. This workflow lets teams test policies in a Dev environment with enforcement disabled before moving to production, and it catches compliance issues early when integrated into CI/CD pipelines. When resources fall out of compliance, remediation tasks run automatically or on demand to correct them, and regular compliance scans occur every 24 hours to keep the environment governed.
Define and Assign Azure Policies
A policy definition specifies conditions and effects using JSON format. The definition includes metadata, policy rules that may use functions, parameters, logical operators, conditions, and property aliases to match specific scenarios. To simplify management, you can combine multiple business rules into a policy initiative (also referred to as a policySet).
Policies are assigned to scopes such as management groups, subscriptions, resource groups, or individual resources. The assignment applies to all resources inside that scope, and you can exclude sub-scopes when necessary. Resources are evaluated for compliance at three key times: when a resource is created or updated inside a scope with a policy assignment, when a new policy or initiative is assigned or updated, and during the standard compliance evaluation cycle that runs every 24 hours.
The compliance dashboard provides an aggregated view of the overall state of the environment and lets you drill down to individual resources and policies. If a resource is non-compliant, the chosen effect determines the response. Effects include Deny (blocks the change), Audit (logs the change), Modify (alters the resource before or after the change), Deploy (deploys related compliant resources), and Block (blocks actions on resources).
Start with the audit effect to see how a policy would impact resources before enforcing it with deny or remediate. Create definitions at higher levels (management group or subscription) and assign them at child levels. Use initiative definitions to group related policies, and manage policy resources as code with manual reviews on changes. For certain Azure Virtual Network Manager dynamic group policies, specific Azure RBAC permissions are required to create, edit, or delete them.
Azure Policy regularly evaluates resources at creation or update, when policies are assigned or changed, and during scheduled compliance scans (every 24 hours). The compliance dashboard tracks states: compliant, non-compliant, exempt, or unknown. You can also use Azure CLI, PowerShell, Azure Monitor logs, and Azure Resource Graph to assess compliance, interpret reports, and identify non-compliant resources.
Policy effects define how Azure responds to non-compliance. Audit logs the event without making changes; Deny blocks the resource creation or update; Modify and DeployIfNotExists alter or deploy resources to bring them into compliance; and Remediate triggers automated tasks to correct existing non-compliant resources. Remediation tasks require a managed identity with appropriate RBAC permissions to update resources. You can manage and track remediation in the Azure portal or via CLI commands like az policy remediation create.
Policy exemptions let you exclude specific resources or scopes from enforcement for business reasons. Exemptions must be documented and regularly reviewed to avoid compliance gaps.
Best practices include starting with the audit effect before enforcing deny or remediate, using compliance data to trigger remediation, mapping policy definitions to organizational standards for clarity, continuously monitoring compliance, and updating or removing policies as Azure evolves. By combining automated compliance monitoring with remediation, organizations keep their Azure subscriptions secure and aligned with regulatory and business requirements.
Differentiate Between Lock Types and Their Effects
Azure resource locks are a governance tool that adds a protective layer over your resources, overriding all user permissions to prevent accidental or unauthorized changes. There are two main lock types, each suited for different scenarios. The CanNotDelete lock (labeled Delete in the portal) allows authorized users to read and modify a resource but blocks its deletion. This is ideal for resources like production storage accounts or DNS zones that need to stay configurable but must not be removed. The ReadOnly lock is more restrictive, preventing both deletion and any updates to the resource, effectively granting everyone the permissions of the Reader role. This lock is best for resources where any change could break compliance or stability.
Effects and Inheritance of Locks
Locks can be applied at different scopes: subscription, resource group, or individual resource. A key concept is inheritance: a lock applied at a parent scope automatically applies to all existing and future child resources. When locks exist at multiple levels, the most restrictive lock in the chain takes precedence. For example, a Delete lock on a resource group prevents deletion of any resource inside it, even if a specific resource has no lock. Importantly, locks only restrict control plane operations—management actions performed through Azure Resource Manager, like scaling a VM or deleting a database. They do not block data plane operations, such as reading or writing data to a storage blob.
Operational Considerations and Best Practices
Applying locks, especially ReadOnly locks, can have significant operational impacts because they block all POST requests to Azure Resource Manager. This can disrupt common tasks like listing storage account keys, starting virtual machines, or running health checks on services like Application Gateway. Before applying a lock, evaluate whether it will interfere with required operations from Azure services like Backup or Site Recovery. Best practices include using CanNotDelete for resources that must remain configurable, reserving ReadOnly for strictly governed resources, and regularly reviewing locks to ensure they don't hinder operations. Locks should be combined with Azure RBAC and Policy for a layered defense strategy.
Locks can be managed through several tools. In the Azure Portal, you use the Locks blade on a resource, resource group, or subscription. For automation, you can use Azure CLI commands like az lock create or Azure PowerShell cmdlets like New-AzResourceLock. You can also define locks directly within ARM Templates for consistent deployment. To create or remove a lock, a user needs permissions like the Owner or User Access Administrator role. Once applied, the lock affects all users, providing a powerful safeguard independent of individual RBAC assignments.
Scenarios for Applying Lock Types
Choosing the right lock depends on your governance needs. Use a CanNotDelete lock for resources that must stay online and configurable but are too critical to risk deletion, such as a core networking hub or a resource group containing production services. Apply a ReadOnly lock to resources that must be frozen in their current state, where any modification—including scaling, moving, or updating—would violate compliance or stability requirements. In complex environments, always consider lock inheritance and how locks interact with other governance tools to maintain both protection and operational integrity.
Implement and Manage Resource Locks
Resource locks are a critical security feature used to prevent the accidental deletion or modification of important Azure resources. Implementing them correctly is key to maintaining a stable and secure cloud environment.
Types of Resource Locks
There are two distinct lock types. The ReadOnly lock ensures the resource can only be read; no updates or deletions are permitted. The CanNotDelete lock allows users to modify the resource's configuration but blocks any attempt to delete it. Understanding this difference is the first step in applying the right control.
Configuring Resource Locks
You can configure locks using multiple interfaces for flexibility. In the Azure Portal, navigate to the Locks section of your chosen resource, resource group, or subscription to add a new lock. For scripted or automated deployment, use PowerShell with the New-AzResourceLock cmdlet or Azure CLI with the az lock create command, specifying the resource, lock name, and lock type.
Implications for Resource Management and Security
Applying locks has direct implications for management and security. They protect critical infrastructure from human error or malicious intent, ensuring essential services remain available. However, they also add complexity to resource management, as administrators must be aware of existing locks to avoid failed operations. From a security perspective, locks act as a final barrier, reducing the risk of configuration drift or catastrophic deletion, even for users with high-level permissions.
Best Practices
Follow best practices to use locks effectively. First, identify critical resources in your subscriptions, such as core networking components or production databases, and apply locks accordingly. Second, conduct a regular review of all locks to ensure they are still necessary and correctly scoped, removing any that obstruct legitimate operations. Finally, maintain clear documentation on why each lock was applied, which aids in troubleshooting and audit processes.
Assess Inheritance and Scope of Resource Locks
Resource locks are powerful administrative safeguards applied to subscriptions, resource groups, or individual resources. Their behavior is governed by rules of inheritance and scope, which are crucial to understand in multi-layered environments.
Lock Inheritance and Precedence
A core principle is lock inheritance: a lock applied at a parent scope (like a subscription) automatically flows down to all child resources within that scope. This inheritance is dynamic and applies to resources added after the lock is created. When multiple locks exist at different levels, the system enforces the most restrictive lock in the chain. This means a single ReadOnly lock on a child resource can override a less restrictive CanNotDelete lock on its parent, and a locked resource can prevent the deletion of its entire parent resource group.
Scope: Control Plane vs. Data Plane
The scope of locks is strictly limited to the control plane, which consists of all management operations sent to Azure Resource Manager. Locks do not affect the data plane, which involves direct interaction with the resource's data. For example, a ReadOnly lock on a storage account blocks you from updating its configuration but does not stop you from reading or writing blobs within it. Administrators must clearly distinguish between managing the resource itself and using the service it provides.
Potential Challenges and System Locks
Applying locks, particularly ReadOnly locks, can introduce challenges because they block all POST requests. This can unexpectedly break administrative functions that rely on POST, such as listing storage account keys, accessing AKS cluster details in the portal, or checking the health of an Application Gateway. Furthermore, some Azure services use managed applications that create resource groups with system-level locks. These system locks cannot be modified directly; they can only be removed by deleting the parent managed service that created them, adding a layer of complexity to resource lifecycle management.
Azure tags are metadata elements made up of key-value pairs that you attach to resources, resource groups, and subscriptions. A tag might look like "Environment = Production" or "CostCenter = Finance." These tags help you organize and manage Azure assets based on how your business works, rather than how Azure's technical structure is set up. Tags do not affect how resources run, but they make a huge difference when you need to find, filter, or report on groups of resources.
Tags integrate directly with Azure Cost Management, which is the tool you use to track and analyze spending. When you apply tags to resources, those tags appear in cost reports and usage files, letting you see exactly how much each department, project, or environment is costing. The special tag called cm-resource-parent lets you group costs by a specific resource ID, such as a host pool, without needing to manually filter results. This makes cost allocation much easier for finance teams and business unit leaders who need to understand where money is being spent.
Access and Governance
To apply tags to Azure resources, you need the proper permissions. The Tag Contributor role lets you tag any resource in a subscription, while the Contributor role gives you access to apply tags to specific resource types you can write to. One important thing to know is that tags do not automatically flow down to resources from their parent resource group or subscription. If you need that behavior, you must set up Azure Policy to enforce tag compliance. A policy can either block deployments that lack required tags using the Deny effect, or automatically add missing tags using the Modify effect, which also supports remediation tasks to fix existing resources.
Limitations to Keep in Mind
Tags come with several limits you need to plan around. Each resource, resource group, or subscription can have at most 50 tag name-value pairs. Tag names are limited to 512 characters (128 for storage accounts), and values are limited to 256 characters. Not all Azure resource types support tags, and some services like Azure DNS and Traffic Manager have restrictions on what characters you can use in tag names. Classic resources such as Cloud Services do not support tags at all. Perhaps most importantly, tags are stored as plain text, so you should never put sensitive information like passwords, secrets, or personal data in them, because they can show up in cost reports and deployment histories.
Implement Tagging Strategies
Building a Consistent Tagging Approach
A good tagging strategy starts with deciding which categories matter most for your organization. Common tags include Environment (Production, Development, Testing), CostCenter, Department, Owner, and Project. The Azure Cloud Adoption Framework provides guidelines that many organizations follow to create consistent naming conventions across their entire environment. When everyone uses the same tag keys and follows the same value patterns, filtering and reporting become much simpler and more reliable.
Tagging Across the Organization
You can apply tags to Azure resources, resource groups, and subscriptions, but you cannot apply them to management groups. Tags work best when they are applied consistently at the time resources are created, because going back to tag existing resources manually takes more effort. ARM templates and Bicep files can define tags as part of the deployment, so every new resource arrives properly organized from day one. This approach also ensures that resources never exist without the tags your organization requires.
Tags become especially valuable when it comes to allocating costs. By tagging resources with a CostCenter or Department key, you can download usage files from the Azure portal and see exactly how much each business unit consumed. The Tags column in these files shows which resources carry which tags, making it easy to build reports that break down spending by environment, project, or any other category that matters to your finance team. This capability supports chargeback scenarios where different departments are billed for the Azure resources they use.
Azure gives you multiple ways to apply and manage tags depending on what you are comfortable with. The Azure Portal lets you add, edit, or remove tags through a graphical interface by opening any resource and looking at the Tags section. Azure CLI and Azure PowerShell offer command-line options, with PowerShell commands like New-AzTag and Update-AzTag being particularly useful for scripting. The Update-AzTag command with the Merge operation adds new tags while keeping existing ones, while the Replace operation overwrites all tags on a resource entirely.
Understanding Tag Behavior and Inheritance
A common misconception is that resources automatically inherit tags from their parent resource group or subscription, but this does not happen by default in Azure. Each resource maintains its own independent set of tags. To make tags flow from parent to child, you must create an Azure Policy with the Modify effect that automatically applies the parent's tags to any new resource that lacks them. This policy-based approach is the only built-in way to achieve automatic tag inheritance at scale.
Tag Limitations and Character Rules
When working with tags, you need to remember several technical constraints. Tag names are case-insensitive for operations, meaning "Environment" and "environment" refer to the same tag, but the casing you choose is preserved in cost reports. Tag values, on the other hand, are case-sensitive, so "Production" and "production" are different values. Some Azure services have their own additional restrictions; for example, Azure Automation and certain DNS resources may support fewer than the standard 50 tags. Always check the documentation for specific resource types if you are planning a large-scale tagging initiative.
Manage resource groups
Implement Governance and Access Controls on Resource Groups
An Azure Resource Group serves as a logical container designed to house resources sharing the same lifecycle. Although resources inside a group can span multiple physical regions, the resource group itself stores its deployment metadata in a single specified location. This structural design makes the choice of a resource group's region a critical decision point for organizations managing strict data residency compliance. To help organize these assets, administrators apply Tags, which are name-value pairs used for categorization and billing, though these tags are not automatically inherited by the resources inside the group.
To protect critical infrastructure from administrative errors, you can implement Resource Locks directly at the resource group scope. These locks are automatically inherited by all child resources and specifically target the Control Plane, meaning they do not restrict data-plane operations such as uploading files to a storage account. You must choose between two distinct lock types based on the level of protection required:
- CanNotDelete: Allows users to read and modify resources but blocks any deletion requests.
- ReadOnly: Restricts users strictly to reading resources, preventing both deletion and modification of configuration settings.
Authorization is managed by Azure Role-Based Access Control (RBAC), which assigns permissions to a Security Principal. When an administrator assigns a Role Definition at the resource group scope, those permissions automatically cascade down to all resources inside the group. This inheritance model simplifies permission management and ensures that the system enforces the principle of least privilege uniformly across all child components.
To enforce compliance at the resource level, organizations use Azure Policy to evaluate resource properties against defined business rules written in JSON format. Unlike RBAC, which controls user identities and permissions, Azure Policy governs the configuration state of the resources themselves, regardless of who created them. When a policy evaluates a resource, it applies one of several enforcement actions:
- Deny: Blocks the creation or update of any resource that violates the defined rules.
- Audit: Generates a compliance report for non-compliant resources without blocking deployment.
- Remediate: Automatically applies corrections to bring non-compliant resources into a compliant state.
The lifecycle of a resource group often ends with its Deletion Process, which is a highly destructive and irreversible operation. Azure Resource Manager coordinates this deletion by first removing any child resources in a specific order before removing the group container. If any active resource locks are present, they will block this deletion, requiring administrators to manually delete the locks before the resource group can be removed.
Creating and configuring resource groups is the first step in setting up an Azure environment, as every resource must reside within one. Administrators can provision resource groups using multiple administrative interfaces, including the Azure Portal, PowerShell, Python SDK, and the Azure CLI. For example, the az group create command allows users to quickly provision a group by specifying a name and location. Administrators can also audit their environment by using az group list to view all active groups or az group show to inspect a specific group's properties.
Once a group is established, you can deploy resources directly into it using the Azure CLI or orchestration templates. For instance, creating an Azure Storage Account requires targeting a specific resource group and defining configuration options such as the location, performance tier, and replication SKU. For automated and repeatable deployments, administrators can run the az deployment group create command to deploy resources defined in ARM templates or Bicep files. This approach ensures that complex environments are configured consistently and align with organizational standards.
Administrators can also apply security locks and retrieve structural configurations directly through the command line to protect and copy resources. To prevent unauthorized modifications, the az lock create command applies a lock to the entire resource group, while other CLI commands allow administrators to list and delete these locks. If an organization needs to replicate an existing environment, they can export the configuration of an active resource group into an ARM template. This exported template serves as a structural blueprint that simplifies the creation of identical resources in other regions or subscriptions.
Manage Resource Group Lifecycle and Organization
Effective management of resource groups involves maintaining control over their active lifecycles and organization. Because each resource can only exist in one resource group, grouping decisions should align closely with the operational lifespan of the resources. When a solution is no longer needed, deleting the resource group cleans up all nested resources simultaneously. This cleanup process relies on Azure Resource Manager, which systematically checks for resource dependencies and retries any failed deletions to ensure no orphaned resources are left behind.
As business requirements change, you may need to reorganize infrastructure by moving resources between resource groups or subscriptions. This operation can be initiated using the Azure Portal, CLI, PowerShell, or the Resource Manager API, but success depends on several constraints. Not all resource types support moves, and some resources have strict dependencies that must be moved together to prevent breaking active connections. Before initiating a move, administrators must verify compatibility and plan for potential service interruptions during the transition.
Resource Tagging provides a lightweight way to organize resources logically across different groups for cost management, compliance, and auditing. These key-value pairs allow billing systems to aggregate costs by department, environment, or project, even if those resources reside in different groups. Administrators must follow strict naming and tagging conventions to maintain consistency and prevent the exposure of sensitive data in tag names or values. Together with Azure RBAC and resource locks, these tagging structures ensure that the entire lifecycle of an Azure environment remains secure, organized, and visible.
Manage subscriptions
Azure role-based access control (Azure RBAC) is the primary system for managing access to Azure resources. RBAC allows you to assign roles to security principals—users, groups, service principals, or managed identities—at scopes such as management group, subscription, resource group, or resource. The main built-in roles are Owner (full management and role assignment), Contributor (manage resources but not RBAC), and Reader (view resources). Specialized roles exist for granular control, and you can create custom roles when built-ins do not meet your requirements.
Role assignments implement the principle of least privilege, ensuring users have only the permissions they need. Assigning a role at a parent scope, such as a management group, means all child resources (subscriptions, resource groups, and resources) inherit that access. For example, assigning Owner at the subscription level enables management of all resources within that subscription. Privileged administrator roles like Owner and User Access Administrator should be limited and carefully audited to reduce security risks.
Management groups provide a hierarchy to organize and govern multiple subscriptions. By creating a hierarchy, you can apply policies and RBAC assignments at higher levels, which are then inherited by all descendant subscriptions and resources. The root management group sits at the top of each Microsoft Entra directory and is used for global policy and access assignments. It is best practice to restrict the root management group to essential, low-impact policies and always test changes before applying them enterprise-wide.
To assign roles at the subscription level, you need appropriate permissions—typically being assigned Owner, User Access Administrator, or Role Based Access Control Administrator at that scope. Assignments can be made using the Azure portal, PowerShell, CLI, or REST API. You can list and audit role assignments using the Access control (IAM) blade, which helps track who has what permissions. Limits exist, such as 4000 role assignments per subscription and 500 per management group.
Auditing and assessing access is essential for security and compliance. Use Azure Monitor activity logs and Privileged Identity Management (PIM) to track changes to role assignments, monitor privileged access, and enforce just-in-time activation. Regularly review who has privileged roles, ensure multiple subscription owners for redundancy (but not too many), and remove deprecated accounts. Azure Policy can enforce access control standards, such as limiting the number of subscription owners or auditing custom RBAC roles.
Automating role assignments and governance at the subscription level is possible using ARM templates or Bicep files. This enables consistent deployment of access controls, policies, and resource groups. When moving subscriptions between management groups, ensure that role definitions and assignments maintain a valid hierarchy path to avoid breaking inherited permissions. Plan and document your access model, and use Azure's built-in tools to regularly assess, monitor, and optimize subscription access and role assignments for effective governance.
Implement Subscription Lifecycle Operations and Resource Organization
Azure allows programmatic creation of subscriptions using REST APIs, ARM templates, or Bicep to automate deployment across Enterprise (EA), Microsoft Customer (MCA), and Partner (MPA) agreements. When managing the subscription lifecycle, administrators must handle subscription transfers carefully: moving a subscription to a different tenant requires the new owner to accept ownership via an email request within seven days. To properly decommission a subscription, delete all resources first to stop charges before formal cancellation.
Management groups provide a governance scope above subscriptions, enabling enterprise-grade management at scale through a hierarchical structure. A single directory supports up to 10,000 management groups with a maximum depth of six levels, excluding the root and subscription levels. Key benefits include policy inheritance (governance conditions apply to all nested subscriptions), access control (RBAC assignments cascade to child resources), and efficient organization (subscriptions can be moved between groups to align with changing business needs).
Effective resource organization relies on resource groups and resource tags to provide business context for cost tracking and management. Resource groups are the lowest level of organization, while tags offer the most flexibility for mapping resources to specific departments, projects, or owners. Using these tools allows organizations to implement cost allocation and chargeback processes, ensuring internal business units are accountable for their specific cloud consumption.
Transferring a subscription to a different Microsoft Entra directory is a complex operation that permanently deletes all RBAC role assignments and custom roles. Administrators must manually re-create these security principals and update both system-assigned and user-assigned managed identities in the target directory. Because this process often involves downtime and significant reconfiguration, careful planning and auditing of all service dependencies is required before execution.
Microsoft Cost Management provides advanced tools like budget alerts and anomaly detection to proactively monitor spending across various scopes. Organizations can use cost analysis to forecast future expenses and identify optimization opportunities, such as Azure savings plans or reservations. To maintain high operational efficiency, administrators should regularly review cost allocation strategies and use Power BI for complex reporting on multi-subscription environments.
Implement Subscription Policies and Billing Management
Billing Management in Azure involves tools and processes to manage costs, subscriptions, and invoices efficiently. The Billing section in the Azure portal provides comprehensive tools to manage billing accounts, pay invoices, and analyze costs. Cost Management is integrated within the billing experience, providing visibility into costs at various levels such as subscriptions, resource groups, and management groups. This integration ensures users can optimize their workloads for maximum efficiency.
Key features include invoice management (view and pay invoices, configure billing addresses, manage purchase orders), cost analysis (using Power BI for advanced reporting and analytics), and exports and APIs to integrate cost details into external systems. Organizing and allocating costs is crucial for internal billing and chargeback processes. Azure provides several options: billing profiles and invoice sections group subscriptions into invoices for different business units; departments and enrollment accounts serve similar roles in cost details; management groups group subscriptions with inherited access and compliance rules; and resource tags add business context for applications, business units, and environments.
Azure offers various alerts to manage costs proactively: budget alerts notify when costs exceed predefined amounts, anomaly alerts detect unexpected charges, and scheduled alerts provide regular updates on cost status. Subscription policies enforce governance and optimize resource allocation. Policies can be configured to manage access to cost data and ensure compliance with organizational requirements. Enable access to costs by configuring settings for different scopes, and manage Azure reservations to optimize cost savings. Effective billing management and subscription policies ensure efficient use of resources and compliance with organizational requirements, leveraging tools like Cost Management, billing profiles, and alerts to optimize cloud spending and maintain control over the Azure environment.
Manage costs by using alerts, budgets, and Azure Advisor recommendations
Establish and Manage Azure Budgets
Azure Budgets are a core tool for proactive cost governance. They allow you to set spending limits for a defined scope, such as a subscription, resource group, or management group. Budgets can be configured to monitor both actual costs and forecasted costs, sending alerts when spending approaches or exceeds set thresholds. This helps enforce financial accountability and identify major cost drivers before they lead to overspending.
Creating and Configuring Budgets
You create budgets manually in the Azure portal or programmatically using the Budgets API. When defining a budget, you set the total amount, the reset period (monthly, quarterly, or annually), and an expiration date. A key feature is setting multiple alert thresholds, usually as a percentage of the budget. These alerts can notify people via email or trigger automated actions through Action Groups, such as shutting down virtual machines to prevent further spending.
Advanced Budget Automation
For stronger control, budgets can integrate with Azure Automation and Azure Logic Apps to run automated workflows when a threshold is breached. This budget-based automation allows for actions like running a script to deallocate resources or modifying policies to block new, costly deployments without manual intervention. This ensures spending stays within limits even during unattended operation.
Analyzing Costs with Budgets
Beyond alerts, budgets support deeper cost analysis. By studying the trends that trigger alerts, you can pinpoint inefficiencies. This analysis is often done alongside Cost Analysis views. Using the Cost Details API or Exports API to get detailed, unaggregated data allows you to investigate exactly which services, resources, or tags are driving costs, leading to more targeted optimization.
Best Practices for Budget Management
Effective budget management requires regular review and adjustment. Budgets should not be "set and forget"; you should iteratively refine budget amounts and thresholds based on historical data and forecasted needs. Aligning budgets with organizational units using tags and management groups improves cost allocation and reporting, ensuring the right teams are accountable for their cloud spending.
Cost Management Alerts help you monitor and control spending by notifying you when costs pass predefined thresholds. This is essential for optimizing resource use and managing expenses proactively.
Setting Up Cost Alerts
You set up cost alerts within the Cost Management + Billing section of the Azure portal, typically by creating a budget. When creating the budget, you can add filters or tags to define its scope, allowing you to track costs for specific resource groups or services and set relevant alert thresholds.
Customizing and Managing Alerts
You can customize how alerts are grouped—by dimensions, tags, or other fields—to focus on the most relevant information. The Alerts page summarizes all alerts from the last 30 days, and you can filter them by subscription, severity, or condition. Each alert has a details page with more information and response options. Alerts are automatically deleted after 30 days, but the underlying alert condition remains until you resolve it.
Programmatic Management
For advanced integration, you can manage alerts programmatically using Azure Resource Graph and the Alert Management REST API. These tools let you create custom views, analyze alert patterns, and update fired alerts outside the portal, integrating alert management into existing workflows and systems.
Leverage Azure Advisor for Cost Optimization
Azure Advisor is a primary tool for cost optimization, working alongside budgets and alerts. Its recommendations are updated daily based on actual usage patterns at the subscription and resource group level. By reviewing these insights, administrators can find idle or underutilized resources to cut costs. Integrating Advisor's recommendations into regular governance practices helps keep deployments cost-effective over time.
Evaluating Impact and Recommendations
When reviewing Azure Advisor cost recommendations, prioritize actions by their potential budget impact. High-impact suggestions often involve purchasing Azure savings plans or reserved instances, which offer significant discounts. Advisor calculates potential yearly savings to help justify these changes. Other critical actions include resizing or shutting down underutilized virtual machines to eliminate waste.
Virtual Machine and Resource Efficiency
A key feature is Advisor's monitoring of virtual machine performance over a seven-day period to spot low utilization. A machine is typically flagged if its CPU utilization is 5% or less and its network usage is under 7 MB for at least four days. This data lets administrators make informed decisions to deallocate or resize specific instances. You can even customize these threshold settings to match your organization's specific performance requirements.
Designing and Structuring Management Group Hierarchies
Azure management groups are logical containers that help organizations manage access, policy, and compliance across multiple subscriptions. By organizing subscriptions into management groups, you can apply governance conditions such as Azure Policy and role assignments at a higher level, and these conditions cascade by inheritance to all child subscriptions and resources. This ensures consistent governance and security across the organization.
The hierarchy starts with the root management group, which is automatically created for each Microsoft Entra tenant. All management groups and subscriptions fold up into this root, allowing for global policies and role assignments at the directory level. You can create up to six levels of management groups (excluding the root and subscription levels), with each management group having only one parent but potentially many children. Subscriptions and management groups can be moved within the hierarchy, but each can have only one parent at a time.
When designing a hierarchy, consider segmenting management groups by business units, environments, or regulatory boundaries to reflect organizational needs. Limit depth to three levels including the root to avoid complexity and operational confusion. Apply policies and RBAC assignments only at scopes where they are truly needed, especially at the root, to minimize unintended impacts. Test enterprise-wide changes in a controlled environment before applying them globally.
Inheritance is a key concept in management group hierarchies. Policies and role assignments applied at a parent management group automatically propagate to all descendant groups and subscriptions. For example, applying a policy to restrict VM creation regions at a parent group will enforce that restriction across all child resources, and subscription owners cannot override it. This inheritance ensures consistent compliance and security, but also means changes at higher levels can have broad impact.
Role assignments and custom roles require careful planning. Azure RBAC roles can be assigned at any level in the hierarchy, and these assignments inherit down to all child resources. However, custom roles have limitations: only one management group can be defined in the assignable scopes of a custom role, custom roles with DataActions cannot be assigned at the management group level, and moving subscriptions or management groups may break the path between role definitions and assignments, requiring updates to role scopes or assignments.
Applying Governance through Management Groups
Management groups are governance containers that allow administrators to manage access, policies, and compliance across multiple Azure subscriptions efficiently. By organizing subscriptions into these groups, any governance conditions applied at the top level automatically cascade to all associated subscriptions and resources through inheritance. This structure provides enterprise-grade management at scale, ensuring that security and operational standards remain consistent throughout an entire organization.
The Azure hierarchy begins with a single root management group that automatically contains every subscription and group within the directory. This tree-like structure supports a maximum depth of six levels, excluding the root and subscription levels, allowing for complex organizational mapping. Each management group or subscription can have only one parent, which maintains a clear and predictable path for inherited permissions.
Administrators leverage Azure Policy and Role-Based Access Control (RBAC) at the management group level to enforce consistent security and compliance across all descendant resources. For instance, a policy assigned to a group can restrict resource deployment to specific regions, and this restriction cannot be altered by lower-level subscription owners. A single role assignment at this level grants users access to all nested subscriptions, significantly reducing the administrative overhead of manual scripting.
While custom roles can be defined with a management group as an assignable scope, there are specific technical limitations to ensure hierarchy stability. You can only define one management group in the assignable scope of a new custom role to prevent role definitions from breaking if a subscription is moved. Additionally, custom roles assigned at the management group scope cannot include DataActions, which are permissions specifically designed for interacting with data inside resources.
Moving subscriptions or groups within the hierarchy requires specific write permissions on the child object, the current parent, and the target parent management group. To further secure the environment, tenant administrators can adjust hierarchy settings to require specific authorization for creating new groups or to designate a default management group for new subscriptions. These proactive controls ensure that all new assets are immediately governed by the organization's mandatory security and compliance frameworks.
Implement and Manage Management Groups
Management groups in Azure are used to organize resources and apply governance policies across multiple subscriptions. They help in structuring resources hierarchically, making it easier to manage and control access.
To configure management groups, you need to understand their structure and purpose. Management groups allow you to create a hierarchy for your Azure resources, which can be used to apply policies and manage access. This hierarchical structure helps in organizing resources effectively and ensures that governance policies are consistently applied.
Assigning roles and permissions within management groups is crucial for maintaining control over your Azure environment. You can assign roles at different levels of the hierarchy, ensuring that users have the appropriate access to resources. This helps in enforcing governance policies and maintaining security across your subscriptions.
Governance policies are essential for maintaining compliance and security in your Azure environment. By applying these policies at the management group level, you can ensure that they are consistently enforced across all subscriptions. This helps in maintaining a standardized approach to resource management and reduces the risk of non-compliance.