Management groups
Management groups provide a tenant-level ARM hierarchy for organizing management groups and subscriptions. The surface keeps each tenant's hierarchy separate, validates subscription ownership and write state, and exposes group and membership changes through synchronous ARM resources. The hierarchy and its subscription placements persist with the directory data store.
ARM surface
The Microsoft.Management surface is tenant-scoped and covers the group tree, its subscription association resources, and the default settings resource. It does not use a resource location.
| Resource or operation | Purpose |
|---|---|
managementGroups | List, create, read, update, patch, delete, and inspect groups. |
managementGroups/subscriptions | Associate a subscription with a group and read or remove that association. |
managementGroups/settings | Return the default management-group settings view. |
getEntities | Return groups and subscriptions with parent chains and child counts. |
checkNameAvailability | Validate a proposed group name in the caller's tenant. |
operations | Describe the management-group operations exposed by the service. |
The surface also accepts the tenant backfill calls used by management-group clients. These calls return a completed status and do not change the hierarchy.
Management-group hierarchy
Each tenant has one root management group. Groups created without a parent become children of that root, while a group can also be placed below another group. The hierarchy is stored by tenant, so the same group name can exist in separate tenant trees.
flowchart TD
T[Tenant root group] --> G1[Management group]
G1 --> G2[Child management group]
G2 --> S1[Subscription]
T --> S2[Unplaced subscription]
The hierarchy supports both structural views and relationship queries. A group can return direct children, a recursive child tree, its path from the tenant root, its ancestor names, or all descendants. The entity view combines these relationships with parent chains and counts from one consistent hierarchy snapshot, so a query does not mix results from different group or subscription placements.
Tenant root groups
The root group is created when a tenant hierarchy is first used. Its name is the tenant ID and its display name is Tenant Root Group. It holds subscriptions that have not been placed under another group. The root cannot be created, changed, or deleted.
References: src/…/ManagementGroupStore.java• L144-147 src/…/ManagementGroupStore.java• L370-381 src/…/ManagementGroupHandler.java• L163-193
Group relationships
Group creation and update preserve a parent relationship inside the same tenant. The service rejects a missing parent and rejects a move that would place a group below itself or one of its descendants. A group can be deleted only after all child groups and child subscriptions have moved elsewhere.
References: src/…/ManagementGroupStore.java• L161-223 src/…/ManagementGroupHandler.java• L196-242
Subscription association store
The association store records the group that owns each placed subscription. It treats an unplaced subscription as a child of the tenant root, so removing a placement returns the subscription to the root rather than deleting the subscription from the directory. A subscription can move between groups, and a removal addressed to an old group does not undo a later move.
References: src/…/ManagementGroupStore.java• L225-303 src/…/ManagementGroupHandler.java• L279-339
Persistent hierarchy
Groups and subscription placements are saved in the shared directory store and rebuilt when the service starts. This gives the management-group view the same persistence boundary as directory subscriptions. Invalid or incomplete stored entries do not prevent valid tenant hierarchies from loading; missing parent links are repaired by attaching the affected group to its tenant root.
References: src/…/ManagementGroupStore.java• L360-381 src/…/ManagementGroupStore.java• L384-455
Tenant-scoped validation
The caller's token tenant selects the hierarchy when that tenant exists in the directory. A caller without a known tenant uses the default tenant. Groups and subscriptions from another tenant are not visible in the selected hierarchy and cannot be associated with it.
Subscription checks
Membership writes apply the ARM subscription rules before they update the hierarchy:
- A known writable subscription can be placed.
- An unknown subscription is registered under the selected tenant unless strict subscription mode is enabled.
- Strict mode returns
404 SubscriptionNotFoundfor an unknown subscription. - A subscription that does not allow writes returns
409 ReadOnlyDisabledSubscription. - A subscription owned by another tenant is rejected with
400 InvalidRequest.
These checks make membership changes part of the same tenant and subscription model used by the wider ARM surface. A successful first-use registration makes the subscription available to later directory and management-group queries.
References: src/…/ManagementGroupHandler.java• L309-329 src/…/ManagementGroupStore.java• L271-286 src/…/SubscriptionRule.java• L14-31 src/…/EmulatorConfig.java• L87-94
Tenant isolation
Tenant isolation applies to every hierarchy query, not only to writes. Listing groups, listing entities, resolving a parent, and expanding descendants all use the selected tenant's root and association set. This prevents a group or subscription created for one configured tenant from appearing in another tenant's management-group view.
References: src/…/ManagementGroupHandler.java• L79-100 src/…/ManagementGroupHandler.java• L343-395 src/…/ManagementGroupStore.java• L237-263 src/…/ManagementGroupTenantScopingTest.java• L55-89
Resource lifecycle
Management-group resources change state synchronously. A successful create or update returns the current group, a successful group delete returns no content, and association writes return the current membership resource.
Group lifecycle
The group lifecycle follows this sequence:
- A valid name is created under the requested parent or the tenant root.
- A later
PUTupdates the display name and parent while preserving the group identity. PATCHchanges the display name or moves the group to another valid parent.DELETEremoves the group only when it has no children.
Names allow ASCII letters, digits, hyphens, underscores, parentheses, and periods, with a maximum length of 90 characters. Operation names such as operations, getEntities, and checkNameAvailability are reserved. Name checks use the selected tenant, so the same name can exist in different tenant hierarchies.
References: src/…/ManagementGroupHandler.java• L196-253 src/…/ManagementGroupHandler.java• L397-412 src/…/ManagementGroupStore.java• L161-212
Membership lifecycle
Subscription membership uses the group resource path /managementGroups/{group}/subscriptions/{subscriptionId}. PUT places or moves the subscription, GET reads the current placement, and DELETE removes only the placement under the addressed group. The subscription remains in the directory and is then visible under the tenant root.
The membership path accepts only one subscription ID segment. A child path below that ID is not treated as a nested resource and returns 404 InvalidResourceType.
References: src/…/ManagementGroupHandler.java• L123-150 src/…/ManagementGroupHandler.java• L295-339 src/…/ManagementGroupStore.java• L271-303 src/…/ManagementGroupTest.java• L117-175
Settings lifecycle
The settings/default resource reports the tenant root as the default management group. Its authorization flag is always false, and writes are acknowledged without changing the returned settings. The settings collection returns that same fixed default resource.
References: src/…/ManagementGroupHandler.java• L428-445 src/…/ManagementGroupTest.java• L196-211
Related pages
The management-group surface sits beside the shared ARM request and authentication path. Read Core routing and authentication for request scope selection, Cloud directory configuration for tenant and subscription ownership, ARM resource governance for common ARM validation, and ARM deployments for deployment flows that can target ARM resources.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the tenant scope in the ARM surface declaration aligned with the handler's tenant selection and the directory's tenant ownership rules.
- Keep group parent validation, descendant expansion, entity parent chains, and subscription association updates consistent when hierarchy rules change.
- Keep hierarchy-derived views on one consistent snapshot when a query returns related groups, ancestors, counts, or subscription placements.
- Keep membership validation aligned with strict-subscription behavior, first-use registration, and read-only subscription states.
- Keep persisted group and placement records compatible with startup reload and with the directory store's persistence mode.
- Keep the fixed settings and synchronous lifecycle responses compatible with clients that use the management-group resource types.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A group is moved below itself or a descendant | The move is rejected with 400 InvalidRequest. | Validate the proposed parent against the current ancestor chain. |
| A non-empty group is deleted | The delete is rejected with 409 Conflict. | Move child groups and subscriptions before deleting the group. |
| An unknown subscription is placed while strict mode is enabled | The placement returns 404 SubscriptionNotFound. | Register the subscription in configuration or disable strict subscription checks. |
| A read-only subscription receives a membership write | The placement returns 409 ReadOnlyDisabledSubscription. | Change the subscription state to a writable state before placing it. |
| A subscription from another tenant is placed | The placement returns 400 InvalidRequest and the association is not stored. | Use a subscription owned by the caller's selected tenant. |
| A hierarchy query derives related rows from different points in time | Parent chains, counts, and placements can disagree in one response. | Build the related view from one tenant hierarchy snapshot. |
| A stored group or placement record is incomplete or unreadable | That entry is skipped during reload. A missing group parent is attached to the tenant root. | Keep persisted records valid and treat reload repair as a signal to inspect stored data. |
Key files
| File | Why to read it |
|---|---|
| src/…/ManagementGroupsArmSurface.java | Defines the tenant-scoped ARM resource types. |
| src/…/ManagementGroupHandler.java | Shows the request surface, hierarchy views, validation, and lifecycle responses. |
| src/…/ManagementGroupStore.java | Defines the hierarchy model, root behavior, parent rules, persistence, consistent reads, and subscription placements. |
| src/…/AzureDirectory.java | Defines tenant ownership, subscription registration, and subscription state. |
| src/…/SubscriptionRule.java | Defines the shared subscription existence and write-state checks. |
| src/…/ManagementGroupTest.java | Demonstrates the main hierarchy, expansion, membership, and lifecycle contracts. |
| src/…/ManagementGroupTenantScopingTest.java | Demonstrates isolation between tenant hierarchies. |
| src/…/ManagementGroupStrictSubscriptionsTest.java | Demonstrates strict, read-only, and cross-tenant membership validation. |