We recommend using Azure Native.
azure.management.Group
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, &core.LookupSubscriptionArgs{}, 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 Group Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Group(name: string, args?: GroupArgs, opts?: CustomResourceOptions);
@overload
def Group(resource_name: str,
args: Optional[GroupArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Group(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 NewGroup(ctx *Context, name string, args *GroupArgs, opts ...ResourceOption) (*Group, error)
public Group(string name, GroupArgs? args = null, CustomResourceOptions? opts = null)
type: azure:management:Group
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 GroupArgs
- 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 GroupArgs
- 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 GroupArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args GroupArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var examplegroupResourceResourceFromManagementgroup = new Azure.Management.Group("examplegroupResourceResourceFromManagementgroup", new()
{
DisplayName = "string",
Name = "string",
ParentManagementGroupId = "string",
SubscriptionIds = new[]
{
"string",
},
});
example, err := management.NewGroup(ctx, "examplegroupResourceResourceFromManagementgroup", &management.GroupArgs{
DisplayName: pulumi.String("string"),
Name: pulumi.String("string"),
ParentManagementGroupId: pulumi.String("string"),
SubscriptionIds: pulumi.StringArray{
pulumi.String("string"),
},
})
var examplegroupResourceResourceFromManagementgroup = new Group("examplegroupResourceResourceFromManagementgroup", GroupArgs.builder()
.displayName("string")
.name("string")
.parentManagementGroupId("string")
.subscriptionIds("string")
.build());
examplegroup_resource_resource_from_managementgroup = azure.management.Group("examplegroupResourceResourceFromManagementgroup",
display_name="string",
name="string",
parent_management_group_id="string",
subscription_ids=["string"])
const examplegroupResourceResourceFromManagementgroup = new azure.management.Group("examplegroupResourceResourceFromManagementgroup", {
displayName: "string",
name: "string",
parentManagementGroupId: "string",
subscriptionIds: ["string"],
});
type: azure:management:Group
properties:
displayName: string
name: string
parentManagementGroupId: string
subscriptionIds:
- string
Group Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Group 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 Group 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 Group Resource
Get an existing Group 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?: GroupState, opts?: CustomResourceOptions): Group
@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) -> Group
func GetGroup(ctx *Context, name string, id IDInput, state *GroupState, opts ...ResourceOption) (*Group, error)
public static Group Get(string name, Input<string> id, GroupState? state, CustomResourceOptions? opts = null)
public static Group get(String name, Output<String> id, GroupState 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:management/group:Group 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.