azure.network.NetworkManagerManagementGroupConnection

Explore with Pulumi AI

Manages a Network Manager Management Group Connection which may cross tenants.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var exampleGroup = new Azure.Management.Group("exampleGroup");

    var alt = Azure.Core.GetSubscription.Invoke(new()
    {
        SubscriptionId = "00000000-0000-0000-0000-000000000000",
    });

    var exampleGroupSubscriptionAssociation = new Azure.Management.GroupSubscriptionAssociation("exampleGroupSubscriptionAssociation", new()
    {
        ManagementGroupId = exampleGroup.Id,
        SubscriptionId = alt.Apply(getSubscriptionResult => getSubscriptionResult.Id),
    });

    var currentSubscription = Azure.Core.GetSubscription.Invoke();

    var currentClientConfig = Azure.Core.GetClientConfig.Invoke();

    var networkContributor = new Azure.Authorization.Assignment("networkContributor", new()
    {
        Scope = exampleGroup.Id,
        RoleDefinitionName = "Network Contributor",
        PrincipalId = currentClientConfig.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
    });

    var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
    {
        Location = "West Europe",
    });

    var exampleNetworkManager = new Azure.Network.NetworkManager("exampleNetworkManager", new()
    {
        Location = exampleResourceGroup.Location,
        ResourceGroupName = exampleResourceGroup.Name,
        Scope = new Azure.Network.Inputs.NetworkManagerScopeArgs
        {
            SubscriptionIds = new[]
            {
                currentSubscription.Apply(getSubscriptionResult => getSubscriptionResult.Id),
            },
        },
        ScopeAccesses = new[]
        {
            "SecurityAdmin",
        },
    });

    var exampleNetworkManagerManagementGroupConnection = new Azure.Network.NetworkManagerManagementGroupConnection("exampleNetworkManagerManagementGroupConnection", new()
    {
        ManagementGroupId = exampleGroup.Id,
        NetworkManagerId = exampleNetworkManager.Id,
        Description = "example",
    }, new CustomResourceOptions
    {
        DependsOn = new[]
        {
            networkContributor,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/management"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleGroup, err := management.NewGroup(ctx, "exampleGroup", nil)
		if err != nil {
			return err
		}
		alt, err := core.LookupSubscription(ctx, &core.LookupSubscriptionArgs{
			SubscriptionId: pulumi.StringRef("00000000-0000-0000-0000-000000000000"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = management.NewGroupSubscriptionAssociation(ctx, "exampleGroupSubscriptionAssociation", &management.GroupSubscriptionAssociationArgs{
			ManagementGroupId: exampleGroup.ID(),
			SubscriptionId:    *pulumi.String(alt.Id),
		})
		if err != nil {
			return err
		}
		currentSubscription, err := core.LookupSubscription(ctx, nil, nil)
		if err != nil {
			return err
		}
		currentClientConfig, err := core.GetClientConfig(ctx, nil, nil)
		if err != nil {
			return err
		}
		networkContributor, err := authorization.NewAssignment(ctx, "networkContributor", &authorization.AssignmentArgs{
			Scope:              exampleGroup.ID(),
			RoleDefinitionName: pulumi.String("Network Contributor"),
			PrincipalId:        *pulumi.String(currentClientConfig.ObjectId),
		})
		if err != nil {
			return err
		}
		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleNetworkManager, err := network.NewNetworkManager(ctx, "exampleNetworkManager", &network.NetworkManagerArgs{
			Location:          exampleResourceGroup.Location,
			ResourceGroupName: exampleResourceGroup.Name,
			Scope: &network.NetworkManagerScopeArgs{
				SubscriptionIds: pulumi.StringArray{
					*pulumi.String(currentSubscription.Id),
				},
			},
			ScopeAccesses: pulumi.StringArray{
				pulumi.String("SecurityAdmin"),
			},
		})
		if err != nil {
			return err
		}
		_, err = network.NewNetworkManagerManagementGroupConnection(ctx, "exampleNetworkManagerManagementGroupConnection", &network.NetworkManagerManagementGroupConnectionArgs{
			ManagementGroupId: exampleGroup.ID(),
			NetworkManagerId:  exampleNetworkManager.ID(),
			Description:       pulumi.String("example"),
		}, pulumi.DependsOn([]pulumi.Resource{
			networkContributor,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.management.Group;
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 com.pulumi.azure.authorization.Assignment;
import com.pulumi.azure.authorization.AssignmentArgs;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.NetworkManager;
import com.pulumi.azure.network.NetworkManagerArgs;
import com.pulumi.azure.network.inputs.NetworkManagerScopeArgs;
import com.pulumi.azure.network.NetworkManagerManagementGroupConnection;
import com.pulumi.azure.network.NetworkManagerManagementGroupConnectionArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
        var exampleGroup = new Group("exampleGroup");

        final var alt = CoreFunctions.getSubscription(GetSubscriptionArgs.builder()
            .subscriptionId("00000000-0000-0000-0000-000000000000")
            .build());

        var exampleGroupSubscriptionAssociation = new GroupSubscriptionAssociation("exampleGroupSubscriptionAssociation", GroupSubscriptionAssociationArgs.builder()        
            .managementGroupId(exampleGroup.id())
            .subscriptionId(alt.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
            .build());

        final var currentSubscription = CoreFunctions.getSubscription();

        final var currentClientConfig = CoreFunctions.getClientConfig();

        var networkContributor = new Assignment("networkContributor", AssignmentArgs.builder()        
            .scope(exampleGroup.id())
            .roleDefinitionName("Network Contributor")
            .principalId(currentClientConfig.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
            .build());

        var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var exampleNetworkManager = new NetworkManager("exampleNetworkManager", NetworkManagerArgs.builder()        
            .location(exampleResourceGroup.location())
            .resourceGroupName(exampleResourceGroup.name())
            .scope(NetworkManagerScopeArgs.builder()
                .subscriptionIds(currentSubscription.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
                .build())
            .scopeAccesses("SecurityAdmin")
            .build());

        var exampleNetworkManagerManagementGroupConnection = new NetworkManagerManagementGroupConnection("exampleNetworkManagerManagementGroupConnection", NetworkManagerManagementGroupConnectionArgs.builder()        
            .managementGroupId(exampleGroup.id())
            .networkManagerId(exampleNetworkManager.id())
            .description("example")
            .build(), CustomResourceOptions.builder()
                .dependsOn(networkContributor)
                .build());

    }
}
import pulumi
import pulumi_azure as azure

example_group = azure.management.Group("exampleGroup")
alt = azure.core.get_subscription(subscription_id="00000000-0000-0000-0000-000000000000")
example_group_subscription_association = azure.management.GroupSubscriptionAssociation("exampleGroupSubscriptionAssociation",
    management_group_id=example_group.id,
    subscription_id=alt.id)
current_subscription = azure.core.get_subscription()
current_client_config = azure.core.get_client_config()
network_contributor = azure.authorization.Assignment("networkContributor",
    scope=example_group.id,
    role_definition_name="Network Contributor",
    principal_id=current_client_config.object_id)
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_network_manager = azure.network.NetworkManager("exampleNetworkManager",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    scope=azure.network.NetworkManagerScopeArgs(
        subscription_ids=[current_subscription.id],
    ),
    scope_accesses=["SecurityAdmin"])
example_network_manager_management_group_connection = azure.network.NetworkManagerManagementGroupConnection("exampleNetworkManagerManagementGroupConnection",
    management_group_id=example_group.id,
    network_manager_id=example_network_manager.id,
    description="example",
    opts=pulumi.ResourceOptions(depends_on=[network_contributor]))
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleGroup = new azure.management.Group("exampleGroup", {});
const alt = azure.core.getSubscription({
    subscriptionId: "00000000-0000-0000-0000-000000000000",
});
const exampleGroupSubscriptionAssociation = new azure.management.GroupSubscriptionAssociation("exampleGroupSubscriptionAssociation", {
    managementGroupId: exampleGroup.id,
    subscriptionId: alt.then(alt => alt.id),
});
const currentSubscription = azure.core.getSubscription({});
const currentClientConfig = azure.core.getClientConfig({});
const networkContributor = new azure.authorization.Assignment("networkContributor", {
    scope: exampleGroup.id,
    roleDefinitionName: "Network Contributor",
    principalId: currentClientConfig.then(currentClientConfig => currentClientConfig.objectId),
});
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleNetworkManager = new azure.network.NetworkManager("exampleNetworkManager", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    scope: {
        subscriptionIds: [currentSubscription.then(currentSubscription => currentSubscription.id)],
    },
    scopeAccesses: ["SecurityAdmin"],
});
const exampleNetworkManagerManagementGroupConnection = new azure.network.NetworkManagerManagementGroupConnection("exampleNetworkManagerManagementGroupConnection", {
    managementGroupId: exampleGroup.id,
    networkManagerId: exampleNetworkManager.id,
    description: "example",
}, {
    dependsOn: [networkContributor],
});
resources:
  exampleGroup:
    type: azure:management:Group
  exampleGroupSubscriptionAssociation:
    type: azure:management:GroupSubscriptionAssociation
    properties:
      managementGroupId: ${exampleGroup.id}
      subscriptionId: ${alt.id}
  networkContributor:
    type: azure:authorization:Assignment
    properties:
      scope: ${exampleGroup.id}
      roleDefinitionName: Network Contributor
      principalId: ${currentClientConfig.objectId}
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  exampleNetworkManager:
    type: azure:network:NetworkManager
    properties:
      location: ${exampleResourceGroup.location}
      resourceGroupName: ${exampleResourceGroup.name}
      scope:
        subscriptionIds:
          - ${currentSubscription.id}
      scopeAccesses:
        - SecurityAdmin
  exampleNetworkManagerManagementGroupConnection:
    type: azure:network:NetworkManagerManagementGroupConnection
    properties:
      managementGroupId: ${exampleGroup.id}
      networkManagerId: ${exampleNetworkManager.id}
      description: example
    options:
      dependson:
        - ${networkContributor}
variables:
  alt:
    fn::invoke:
      Function: azure:core:getSubscription
      Arguments:
        subscriptionId: 00000000-0000-0000-0000-000000000000
  currentSubscription:
    fn::invoke:
      Function: azure:core:getSubscription
      Arguments: {}
  currentClientConfig:
    fn::invoke:
      Function: azure:core:getClientConfig
      Arguments: {}

Create NetworkManagerManagementGroupConnection Resource

new NetworkManagerManagementGroupConnection(name: string, args: NetworkManagerManagementGroupConnectionArgs, opts?: CustomResourceOptions);
@overload
def NetworkManagerManagementGroupConnection(resource_name: str,
                                            opts: Optional[ResourceOptions] = None,
                                            description: Optional[str] = None,
                                            management_group_id: Optional[str] = None,
                                            name: Optional[str] = None,
                                            network_manager_id: Optional[str] = None)
@overload
def NetworkManagerManagementGroupConnection(resource_name: str,
                                            args: NetworkManagerManagementGroupConnectionArgs,
                                            opts: Optional[ResourceOptions] = None)
func NewNetworkManagerManagementGroupConnection(ctx *Context, name string, args NetworkManagerManagementGroupConnectionArgs, opts ...ResourceOption) (*NetworkManagerManagementGroupConnection, error)
public NetworkManagerManagementGroupConnection(string name, NetworkManagerManagementGroupConnectionArgs args, CustomResourceOptions? opts = null)
public NetworkManagerManagementGroupConnection(String name, NetworkManagerManagementGroupConnectionArgs args)
public NetworkManagerManagementGroupConnection(String name, NetworkManagerManagementGroupConnectionArgs args, CustomResourceOptions options)
type: azure:network:NetworkManagerManagementGroupConnection
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args NetworkManagerManagementGroupConnectionArgs
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 NetworkManagerManagementGroupConnectionArgs
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 NetworkManagerManagementGroupConnectionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args NetworkManagerManagementGroupConnectionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args NetworkManagerManagementGroupConnectionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

NetworkManagerManagementGroupConnection 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 NetworkManagerManagementGroupConnection resource accepts the following input properties:

ManagementGroupId string

Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

NetworkManagerId string

Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

Description string

A description of the Network Manager Management Group Connection.

Name string

Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

ManagementGroupId string

Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

NetworkManagerId string

Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

Description string

A description of the Network Manager Management Group Connection.

Name string

Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

managementGroupId String

Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

networkManagerId String

Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

description String

A description of the Network Manager Management Group Connection.

name String

Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

managementGroupId string

Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

networkManagerId string

Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

description string

A description of the Network Manager Management Group Connection.

name string

Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

management_group_id str

Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

network_manager_id str

Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

description str

A description of the Network Manager Management Group Connection.

name str

Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

managementGroupId String

Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

networkManagerId String

Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

description String

A description of the Network Manager Management Group Connection.

name String

Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the NetworkManagerManagementGroupConnection resource produces the following output properties:

ConnectionState string

The Connection state of the Network Manager Management Group Connection.

Id string

The provider-assigned unique ID for this managed resource.

ConnectionState string

The Connection state of the Network Manager Management Group Connection.

Id string

The provider-assigned unique ID for this managed resource.

connectionState String

The Connection state of the Network Manager Management Group Connection.

id String

The provider-assigned unique ID for this managed resource.

connectionState string

The Connection state of the Network Manager Management Group Connection.

id string

The provider-assigned unique ID for this managed resource.

connection_state str

The Connection state of the Network Manager Management Group Connection.

id str

The provider-assigned unique ID for this managed resource.

connectionState String

The Connection state of the Network Manager Management Group Connection.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing NetworkManagerManagementGroupConnection Resource

Get an existing NetworkManagerManagementGroupConnection 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?: NetworkManagerManagementGroupConnectionState, opts?: CustomResourceOptions): NetworkManagerManagementGroupConnection
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        connection_state: Optional[str] = None,
        description: Optional[str] = None,
        management_group_id: Optional[str] = None,
        name: Optional[str] = None,
        network_manager_id: Optional[str] = None) -> NetworkManagerManagementGroupConnection
func GetNetworkManagerManagementGroupConnection(ctx *Context, name string, id IDInput, state *NetworkManagerManagementGroupConnectionState, opts ...ResourceOption) (*NetworkManagerManagementGroupConnection, error)
public static NetworkManagerManagementGroupConnection Get(string name, Input<string> id, NetworkManagerManagementGroupConnectionState? state, CustomResourceOptions? opts = null)
public static NetworkManagerManagementGroupConnection get(String name, Output<String> id, NetworkManagerManagementGroupConnectionState 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.
The following state arguments are supported:
ConnectionState string

The Connection state of the Network Manager Management Group Connection.

Description string

A description of the Network Manager Management Group Connection.

ManagementGroupId string

Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

Name string

Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

NetworkManagerId string

Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

ConnectionState string

The Connection state of the Network Manager Management Group Connection.

Description string

A description of the Network Manager Management Group Connection.

ManagementGroupId string

Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

Name string

Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

NetworkManagerId string

Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

connectionState String

The Connection state of the Network Manager Management Group Connection.

description String

A description of the Network Manager Management Group Connection.

managementGroupId String

Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

name String

Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

networkManagerId String

Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

connectionState string

The Connection state of the Network Manager Management Group Connection.

description string

A description of the Network Manager Management Group Connection.

managementGroupId string

Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

name string

Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

networkManagerId string

Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

connection_state str

The Connection state of the Network Manager Management Group Connection.

description str

A description of the Network Manager Management Group Connection.

management_group_id str

Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

name str

Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

network_manager_id str

Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

connectionState String

The Connection state of the Network Manager Management Group Connection.

description String

A description of the Network Manager Management Group Connection.

managementGroupId String

Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

name String

Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

networkManagerId String

Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

Import

Network Manager Management Group Connection can be imported using the resource id, e.g.

 $ pulumi import azure:network/networkManagerManagementGroupConnection:NetworkManagerManagementGroupConnection example /providers/Microsoft.Management/managementGroups/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/networkManagerConnection1

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.