We recommend using Azure Native.
azure.managementgroups.ManagementGroup
Explore with Pulumi AI
Manages a Management Group.
!> Note: Configuring subscription_ids
is not supported when using the azure.management.GroupSubscriptionAssociation
resource, results will be unpredictable.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const current = azure.core.getSubscription({});
const exampleParent = new azure.management.Group("example_parent", {
displayName: "ParentGroup",
subscriptionIds: [current.then(current => current.subscriptionId)],
});
const exampleChild = new azure.management.Group("example_child", {
displayName: "ChildGroup",
parentManagementGroupId: exampleParent.id,
subscriptionIds: [current.then(current => current.subscriptionId)],
});
import pulumi
import pulumi_azure as azure
current = azure.core.get_subscription()
example_parent = azure.management.Group("example_parent",
display_name="ParentGroup",
subscription_ids=[current.subscription_id])
example_child = azure.management.Group("example_child",
display_name="ChildGroup",
parent_management_group_id=example_parent.id,
subscription_ids=[current.subscription_id])
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/management"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
current, err := core.LookupSubscription(ctx, nil, nil)
if err != nil {
return err
}
exampleParent, err := management.NewGroup(ctx, "example_parent", &management.GroupArgs{
DisplayName: pulumi.String("ParentGroup"),
SubscriptionIds: pulumi.StringArray{
pulumi.String(current.SubscriptionId),
},
})
if err != nil {
return err
}
_, err = management.NewGroup(ctx, "example_child", &management.GroupArgs{
DisplayName: pulumi.String("ChildGroup"),
ParentManagementGroupId: exampleParent.ID(),
SubscriptionIds: pulumi.StringArray{
pulumi.String(current.SubscriptionId),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var current = Azure.Core.GetSubscription.Invoke();
var exampleParent = new Azure.Management.Group("example_parent", new()
{
DisplayName = "ParentGroup",
SubscriptionIds = new[]
{
current.Apply(getSubscriptionResult => getSubscriptionResult.SubscriptionId),
},
});
var exampleChild = new Azure.Management.Group("example_child", new()
{
DisplayName = "ChildGroup",
ParentManagementGroupId = exampleParent.Id,
SubscriptionIds = new[]
{
current.Apply(getSubscriptionResult => getSubscriptionResult.SubscriptionId),
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.CoreFunctions;
import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
import com.pulumi.azure.management.Group;
import com.pulumi.azure.management.GroupArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var current = CoreFunctions.getSubscription();
var exampleParent = new Group("exampleParent", GroupArgs.builder()
.displayName("ParentGroup")
.subscriptionIds(current.applyValue(getSubscriptionResult -> getSubscriptionResult.subscriptionId()))
.build());
var exampleChild = new Group("exampleChild", GroupArgs.builder()
.displayName("ChildGroup")
.parentManagementGroupId(exampleParent.id())
.subscriptionIds(current.applyValue(getSubscriptionResult -> getSubscriptionResult.subscriptionId()))
.build());
}
}
resources:
exampleParent:
type: azure:management:Group
name: example_parent
properties:
displayName: ParentGroup
subscriptionIds:
- ${current.subscriptionId}
exampleChild:
type: azure:management:Group
name: example_child
properties:
displayName: ChildGroup
parentManagementGroupId: ${exampleParent.id}
subscriptionIds: # other subscription IDs can go here
- ${current.subscriptionId}
variables:
current:
fn::invoke:
Function: azure:core:getSubscription
Arguments: {}
Create ManagementGroup Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ManagementGroup(name: string, args?: ManagementGroupArgs, opts?: CustomResourceOptions);
@overload
def ManagementGroup(resource_name: str,
args: Optional[ManagementGroupArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def ManagementGroup(resource_name: str,
opts: Optional[ResourceOptions] = None,
display_name: Optional[str] = None,
name: Optional[str] = None,
parent_management_group_id: Optional[str] = None,
subscription_ids: Optional[Sequence[str]] = None)
func NewManagementGroup(ctx *Context, name string, args *ManagementGroupArgs, opts ...ResourceOption) (*ManagementGroup, error)
public ManagementGroup(string name, ManagementGroupArgs? args = null, CustomResourceOptions? opts = null)
public ManagementGroup(String name, ManagementGroupArgs args)
public ManagementGroup(String name, ManagementGroupArgs args, CustomResourceOptions options)
type: azure:managementgroups:ManagementGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ManagementGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ManagementGroupArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ManagementGroupArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ManagementGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ManagementGroupArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
ManagementGroup Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The ManagementGroup resource accepts the following input properties:
- Display
Name string - A friendly name for this Management Group. If not specified, this will be the same as the
name
. - Name string
- The name or UUID for this Management Group, which needs to be unique across your tenant. A new UUID will be generated if not provided. Changing this forces a new resource to be created.
- Parent
Management stringGroup Id - The ID of the Parent Management Group.
- Subscription
Ids List<string> A list of Subscription GUIDs which should be assigned to the Management Group.
Note: To clear all Subscriptions from the Management Group set
subscription_ids
to an empty list
- Display
Name string - A friendly name for this Management Group. If not specified, this will be the same as the
name
. - Name string
- The name or UUID for this Management Group, which needs to be unique across your tenant. A new UUID will be generated if not provided. Changing this forces a new resource to be created.
- Parent
Management stringGroup Id - The ID of the Parent Management Group.
- Subscription
Ids []string A list of Subscription GUIDs which should be assigned to the Management Group.
Note: To clear all Subscriptions from the Management Group set
subscription_ids
to an empty list
- display
Name String - A friendly name for this Management Group. If not specified, this will be the same as the
name
. - name String
- The name or UUID for this Management Group, which needs to be unique across your tenant. A new UUID will be generated if not provided. Changing this forces a new resource to be created.
- parent
Management StringGroup Id - The ID of the Parent Management Group.
- subscription
Ids List<String> A list of Subscription GUIDs which should be assigned to the Management Group.
Note: To clear all Subscriptions from the Management Group set
subscription_ids
to an empty list
- display
Name string - A friendly name for this Management Group. If not specified, this will be the same as the
name
. - name string
- The name or UUID for this Management Group, which needs to be unique across your tenant. A new UUID will be generated if not provided. Changing this forces a new resource to be created.
- parent
Management stringGroup Id - The ID of the Parent Management Group.
- subscription
Ids string[] A list of Subscription GUIDs which should be assigned to the Management Group.
Note: To clear all Subscriptions from the Management Group set
subscription_ids
to an empty list
- display_
name str - A friendly name for this Management Group. If not specified, this will be the same as the
name
. - name str
- The name or UUID for this Management Group, which needs to be unique across your tenant. A new UUID will be generated if not provided. Changing this forces a new resource to be created.
- parent_
management_ strgroup_ id - The ID of the Parent Management Group.
- subscription_
ids Sequence[str] A list of Subscription GUIDs which should be assigned to the Management Group.
Note: To clear all Subscriptions from the Management Group set
subscription_ids
to an empty list
- display
Name String - A friendly name for this Management Group. If not specified, this will be the same as the
name
. - name String
- The name or UUID for this Management Group, which needs to be unique across your tenant. A new UUID will be generated if not provided. Changing this forces a new resource to be created.
- parent
Management StringGroup Id - The ID of the Parent Management Group.
- subscription
Ids List<String> A list of Subscription GUIDs which should be assigned to the Management Group.
Note: To clear all Subscriptions from the Management Group set
subscription_ids
to an empty list
Outputs
All input properties are implicitly available as output properties. Additionally, the ManagementGroup resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Tenant
Scoped stringId - The Management Group ID with the Tenant ID prefix.
- Id string
- The provider-assigned unique ID for this managed resource.
- Tenant
Scoped stringId - The Management Group ID with the Tenant ID prefix.
- id String
- The provider-assigned unique ID for this managed resource.
- tenant
Scoped StringId - The Management Group ID with the Tenant ID prefix.
- id string
- The provider-assigned unique ID for this managed resource.
- tenant
Scoped stringId - The Management Group ID with the Tenant ID prefix.
- id str
- The provider-assigned unique ID for this managed resource.
- tenant_
scoped_ strid - The Management Group ID with the Tenant ID prefix.
- id String
- The provider-assigned unique ID for this managed resource.
- tenant
Scoped StringId - The Management Group ID with the Tenant ID prefix.
Look up Existing ManagementGroup Resource
Get an existing ManagementGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ManagementGroupState, opts?: CustomResourceOptions): ManagementGroup
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
display_name: Optional[str] = None,
name: Optional[str] = None,
parent_management_group_id: Optional[str] = None,
subscription_ids: Optional[Sequence[str]] = None,
tenant_scoped_id: Optional[str] = None) -> ManagementGroup
func GetManagementGroup(ctx *Context, name string, id IDInput, state *ManagementGroupState, opts ...ResourceOption) (*ManagementGroup, error)
public static ManagementGroup Get(string name, Input<string> id, ManagementGroupState? state, CustomResourceOptions? opts = null)
public static ManagementGroup get(String name, Output<String> id, ManagementGroupState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Display
Name string - A friendly name for this Management Group. If not specified, this will be the same as the
name
. - Name string
- The name or UUID for this Management Group, which needs to be unique across your tenant. A new UUID will be generated if not provided. Changing this forces a new resource to be created.
- Parent
Management stringGroup Id - The ID of the Parent Management Group.
- Subscription
Ids List<string> A list of Subscription GUIDs which should be assigned to the Management Group.
Note: To clear all Subscriptions from the Management Group set
subscription_ids
to an empty list- Tenant
Scoped stringId - The Management Group ID with the Tenant ID prefix.
- Display
Name string - A friendly name for this Management Group. If not specified, this will be the same as the
name
. - Name string
- The name or UUID for this Management Group, which needs to be unique across your tenant. A new UUID will be generated if not provided. Changing this forces a new resource to be created.
- Parent
Management stringGroup Id - The ID of the Parent Management Group.
- Subscription
Ids []string A list of Subscription GUIDs which should be assigned to the Management Group.
Note: To clear all Subscriptions from the Management Group set
subscription_ids
to an empty list- Tenant
Scoped stringId - The Management Group ID with the Tenant ID prefix.
- display
Name String - A friendly name for this Management Group. If not specified, this will be the same as the
name
. - name String
- The name or UUID for this Management Group, which needs to be unique across your tenant. A new UUID will be generated if not provided. Changing this forces a new resource to be created.
- parent
Management StringGroup Id - The ID of the Parent Management Group.
- subscription
Ids List<String> A list of Subscription GUIDs which should be assigned to the Management Group.
Note: To clear all Subscriptions from the Management Group set
subscription_ids
to an empty list- tenant
Scoped StringId - The Management Group ID with the Tenant ID prefix.
- display
Name string - A friendly name for this Management Group. If not specified, this will be the same as the
name
. - name string
- The name or UUID for this Management Group, which needs to be unique across your tenant. A new UUID will be generated if not provided. Changing this forces a new resource to be created.
- parent
Management stringGroup Id - The ID of the Parent Management Group.
- subscription
Ids string[] A list of Subscription GUIDs which should be assigned to the Management Group.
Note: To clear all Subscriptions from the Management Group set
subscription_ids
to an empty list- tenant
Scoped stringId - The Management Group ID with the Tenant ID prefix.
- display_
name str - A friendly name for this Management Group. If not specified, this will be the same as the
name
. - name str
- The name or UUID for this Management Group, which needs to be unique across your tenant. A new UUID will be generated if not provided. Changing this forces a new resource to be created.
- parent_
management_ strgroup_ id - The ID of the Parent Management Group.
- subscription_
ids Sequence[str] A list of Subscription GUIDs which should be assigned to the Management Group.
Note: To clear all Subscriptions from the Management Group set
subscription_ids
to an empty list- tenant_
scoped_ strid - The Management Group ID with the Tenant ID prefix.
- display
Name String - A friendly name for this Management Group. If not specified, this will be the same as the
name
. - name String
- The name or UUID for this Management Group, which needs to be unique across your tenant. A new UUID will be generated if not provided. Changing this forces a new resource to be created.
- parent
Management StringGroup Id - The ID of the Parent Management Group.
- subscription
Ids List<String> A list of Subscription GUIDs which should be assigned to the Management Group.
Note: To clear all Subscriptions from the Management Group set
subscription_ids
to an empty list- tenant
Scoped StringId - The Management Group ID with the Tenant ID prefix.
Import
Management Groups can be imported using the management group resource id
, e.g.
$ pulumi import azure:managementgroups/managementGroup:ManagementGroup example /providers/Microsoft.Management/managementGroups/group1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurerm
Terraform Provider.