We recommend using Azure Native.
azure.management.GroupSubscriptionAssociation
Explore with Pulumi AI
Manages a Management Group Subscription Association.
!> Note: When using this resource, configuring subscription_ids
on the azure.management.Group
resource is not supported.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.management.getGroup({
name: "exampleManagementGroup",
});
const exampleGetSubscription = azure.core.getSubscription({
subscriptionId: "12345678-1234-1234-1234-123456789012",
});
const exampleGroupSubscriptionAssociation = new azure.management.GroupSubscriptionAssociation("example", {
managementGroupId: example.then(example => example.id),
subscriptionId: exampleGetSubscription.then(exampleGetSubscription => exampleGetSubscription.id),
});
import pulumi
import pulumi_azure as azure
example = azure.management.get_group(name="exampleManagementGroup")
example_get_subscription = azure.core.get_subscription(subscription_id="12345678-1234-1234-1234-123456789012")
example_group_subscription_association = azure.management.GroupSubscriptionAssociation("example",
management_group_id=example.id,
subscription_id=example_get_subscription.id)
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/management"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := management.LookupGroup(ctx, &management.LookupGroupArgs{
Name: pulumi.StringRef("exampleManagementGroup"),
}, nil)
if err != nil {
return err
}
exampleGetSubscription, err := core.LookupSubscription(ctx, &core.LookupSubscriptionArgs{
SubscriptionId: pulumi.StringRef("12345678-1234-1234-1234-123456789012"),
}, nil)
if err != nil {
return err
}
_, err = management.NewGroupSubscriptionAssociation(ctx, "example", &management.GroupSubscriptionAssociationArgs{
ManagementGroupId: pulumi.String(example.Id),
SubscriptionId: pulumi.String(exampleGetSubscription.Id),
})
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 example = Azure.Management.GetGroup.Invoke(new()
{
Name = "exampleManagementGroup",
});
var exampleGetSubscription = Azure.Core.GetSubscription.Invoke(new()
{
SubscriptionId = "12345678-1234-1234-1234-123456789012",
});
var exampleGroupSubscriptionAssociation = new Azure.Management.GroupSubscriptionAssociation("example", new()
{
ManagementGroupId = example.Apply(getGroupResult => getGroupResult.Id),
SubscriptionId = exampleGetSubscription.Apply(getSubscriptionResult => getSubscriptionResult.Id),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.management.ManagementFunctions;
import com.pulumi.azure.management.inputs.GetGroupArgs;
import com.pulumi.azure.core.CoreFunctions;
import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
import com.pulumi.azure.management.GroupSubscriptionAssociation;
import com.pulumi.azure.management.GroupSubscriptionAssociationArgs;
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 example = ManagementFunctions.getGroup(GetGroupArgs.builder()
.name("exampleManagementGroup")
.build());
final var exampleGetSubscription = CoreFunctions.getSubscription(GetSubscriptionArgs.builder()
.subscriptionId("12345678-1234-1234-1234-123456789012")
.build());
var exampleGroupSubscriptionAssociation = new GroupSubscriptionAssociation("exampleGroupSubscriptionAssociation", GroupSubscriptionAssociationArgs.builder()
.managementGroupId(example.applyValue(getGroupResult -> getGroupResult.id()))
.subscriptionId(exampleGetSubscription.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
.build());
}
}
resources:
exampleGroupSubscriptionAssociation:
type: azure:management:GroupSubscriptionAssociation
name: example
properties:
managementGroupId: ${example.id}
subscriptionId: ${exampleGetSubscription.id}
variables:
example:
fn::invoke:
Function: azure:management:getGroup
Arguments:
name: exampleManagementGroup
exampleGetSubscription:
fn::invoke:
Function: azure:core:getSubscription
Arguments:
subscriptionId: 12345678-1234-1234-1234-123456789012
Create GroupSubscriptionAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new GroupSubscriptionAssociation(name: string, args: GroupSubscriptionAssociationArgs, opts?: CustomResourceOptions);
@overload
def GroupSubscriptionAssociation(resource_name: str,
args: GroupSubscriptionAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def GroupSubscriptionAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
management_group_id: Optional[str] = None,
subscription_id: Optional[str] = None)
func NewGroupSubscriptionAssociation(ctx *Context, name string, args GroupSubscriptionAssociationArgs, opts ...ResourceOption) (*GroupSubscriptionAssociation, error)
public GroupSubscriptionAssociation(string name, GroupSubscriptionAssociationArgs args, CustomResourceOptions? opts = null)
public GroupSubscriptionAssociation(String name, GroupSubscriptionAssociationArgs args)
public GroupSubscriptionAssociation(String name, GroupSubscriptionAssociationArgs args, CustomResourceOptions options)
type: azure:management:GroupSubscriptionAssociation
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 GroupSubscriptionAssociationArgs
- 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 GroupSubscriptionAssociationArgs
- 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 GroupSubscriptionAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GroupSubscriptionAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args GroupSubscriptionAssociationArgs
- 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 groupSubscriptionAssociationResource = new Azure.Management.GroupSubscriptionAssociation("groupSubscriptionAssociationResource", new()
{
ManagementGroupId = "string",
SubscriptionId = "string",
});
example, err := management.NewGroupSubscriptionAssociation(ctx, "groupSubscriptionAssociationResource", &management.GroupSubscriptionAssociationArgs{
ManagementGroupId: pulumi.String("string"),
SubscriptionId: pulumi.String("string"),
})
var groupSubscriptionAssociationResource = new GroupSubscriptionAssociation("groupSubscriptionAssociationResource", GroupSubscriptionAssociationArgs.builder()
.managementGroupId("string")
.subscriptionId("string")
.build());
group_subscription_association_resource = azure.management.GroupSubscriptionAssociation("groupSubscriptionAssociationResource",
management_group_id="string",
subscription_id="string")
const groupSubscriptionAssociationResource = new azure.management.GroupSubscriptionAssociation("groupSubscriptionAssociationResource", {
managementGroupId: "string",
subscriptionId: "string",
});
type: azure:management:GroupSubscriptionAssociation
properties:
managementGroupId: string
subscriptionId: string
GroupSubscriptionAssociation 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 GroupSubscriptionAssociation resource accepts the following input properties:
- Management
Group stringId - The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.
- Subscription
Id string - The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.
- Management
Group stringId - The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.
- Subscription
Id string - The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.
- management
Group StringId - The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.
- subscription
Id String - The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.
- management
Group stringId - The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.
- subscription
Id string - The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.
- management_
group_ strid - The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.
- subscription_
id str - The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.
- management
Group StringId - The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.
- subscription
Id String - The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.
Outputs
All input properties are implicitly available as output properties. Additionally, the GroupSubscriptionAssociation resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing GroupSubscriptionAssociation Resource
Get an existing GroupSubscriptionAssociation 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?: GroupSubscriptionAssociationState, opts?: CustomResourceOptions): GroupSubscriptionAssociation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
management_group_id: Optional[str] = None,
subscription_id: Optional[str] = None) -> GroupSubscriptionAssociation
func GetGroupSubscriptionAssociation(ctx *Context, name string, id IDInput, state *GroupSubscriptionAssociationState, opts ...ResourceOption) (*GroupSubscriptionAssociation, error)
public static GroupSubscriptionAssociation Get(string name, Input<string> id, GroupSubscriptionAssociationState? state, CustomResourceOptions? opts = null)
public static GroupSubscriptionAssociation get(String name, Output<String> id, GroupSubscriptionAssociationState 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.
- Management
Group stringId - The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.
- Subscription
Id string - The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.
- Management
Group stringId - The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.
- Subscription
Id string - The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.
- management
Group StringId - The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.
- subscription
Id String - The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.
- management
Group stringId - The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.
- subscription
Id string - The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.
- management_
group_ strid - The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.
- subscription_
id str - The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.
- management
Group StringId - The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.
- subscription
Id String - The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.
Import
Managements can be imported using the resource id
, e.g.
$ pulumi import azure:management/groupSubscriptionAssociation:GroupSubscriptionAssociation example /managementGroup/MyManagementGroup/subscription/12345678-1234-1234-1234-123456789012
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.