1. Packages
  2. Azure Classic
  3. API Docs
  4. apimanagement
  5. GroupUser

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.apimanagement.GroupUser

Explore with Pulumi AI

Manages an API Management User Assignment to a Group.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.apimanagement.getUser({
    userId: "my-user",
    apiManagementName: "example-apim",
    resourceGroupName: "search-service",
});
const exampleGroupUser = new azure.apimanagement.GroupUser("example", {
    userId: example.then(example => example.id),
    groupName: "example-group",
    resourceGroupName: example.then(example => example.resourceGroupName),
    apiManagementName: example.then(example => example.apiManagementName),
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.apimanagement.get_user(user_id="my-user",
    api_management_name="example-apim",
    resource_group_name="search-service")
example_group_user = azure.apimanagement.GroupUser("example",
    user_id=example.id,
    group_name="example-group",
    resource_group_name=example.resource_group_name,
    api_management_name=example.api_management_name)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/apimanagement"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := apimanagement.LookupUser(ctx, &apimanagement.LookupUserArgs{
			UserId:            "my-user",
			ApiManagementName: "example-apim",
			ResourceGroupName: "search-service",
		}, nil)
		if err != nil {
			return err
		}
		_, err = apimanagement.NewGroupUser(ctx, "example", &apimanagement.GroupUserArgs{
			UserId:            pulumi.String(example.Id),
			GroupName:         pulumi.String("example-group"),
			ResourceGroupName: pulumi.String(example.ResourceGroupName),
			ApiManagementName: pulumi.String(example.ApiManagementName),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.ApiManagement.GetUser.Invoke(new()
    {
        UserId = "my-user",
        ApiManagementName = "example-apim",
        ResourceGroupName = "search-service",
    });

    var exampleGroupUser = new Azure.ApiManagement.GroupUser("example", new()
    {
        UserId = example.Apply(getUserResult => getUserResult.Id),
        GroupName = "example-group",
        ResourceGroupName = example.Apply(getUserResult => getUserResult.ResourceGroupName),
        ApiManagementName = example.Apply(getUserResult => getUserResult.ApiManagementName),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.apimanagement.ApimanagementFunctions;
import com.pulumi.azure.apimanagement.inputs.GetUserArgs;
import com.pulumi.azure.apimanagement.GroupUser;
import com.pulumi.azure.apimanagement.GroupUserArgs;
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 = ApimanagementFunctions.getUser(GetUserArgs.builder()
            .userId("my-user")
            .apiManagementName("example-apim")
            .resourceGroupName("search-service")
            .build());

        var exampleGroupUser = new GroupUser("exampleGroupUser", GroupUserArgs.builder()
            .userId(example.applyValue(getUserResult -> getUserResult.id()))
            .groupName("example-group")
            .resourceGroupName(example.applyValue(getUserResult -> getUserResult.resourceGroupName()))
            .apiManagementName(example.applyValue(getUserResult -> getUserResult.apiManagementName()))
            .build());

    }
}
Copy
resources:
  exampleGroupUser:
    type: azure:apimanagement:GroupUser
    name: example
    properties:
      userId: ${example.id}
      groupName: example-group
      resourceGroupName: ${example.resourceGroupName}
      apiManagementName: ${example.apiManagementName}
variables:
  example:
    fn::invoke:
      function: azure:apimanagement:getUser
      arguments:
        userId: my-user
        apiManagementName: example-apim
        resourceGroupName: search-service
Copy

Create GroupUser Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new GroupUser(name: string, args: GroupUserArgs, opts?: CustomResourceOptions);
@overload
def GroupUser(resource_name: str,
              args: GroupUserArgs,
              opts: Optional[ResourceOptions] = None)

@overload
def GroupUser(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              api_management_name: Optional[str] = None,
              group_name: Optional[str] = None,
              resource_group_name: Optional[str] = None,
              user_id: Optional[str] = None)
func NewGroupUser(ctx *Context, name string, args GroupUserArgs, opts ...ResourceOption) (*GroupUser, error)
public GroupUser(string name, GroupUserArgs args, CustomResourceOptions? opts = null)
public GroupUser(String name, GroupUserArgs args)
public GroupUser(String name, GroupUserArgs args, CustomResourceOptions options)
type: azure:apimanagement:GroupUser
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. GroupUserArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. GroupUserArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. GroupUserArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. GroupUserArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. GroupUserArgs
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 groupUserResource = new Azure.ApiManagement.GroupUser("groupUserResource", new()
{
    ApiManagementName = "string",
    GroupName = "string",
    ResourceGroupName = "string",
    UserId = "string",
});
Copy
example, err := apimanagement.NewGroupUser(ctx, "groupUserResource", &apimanagement.GroupUserArgs{
	ApiManagementName: pulumi.String("string"),
	GroupName:         pulumi.String("string"),
	ResourceGroupName: pulumi.String("string"),
	UserId:            pulumi.String("string"),
})
Copy
var groupUserResource = new GroupUser("groupUserResource", GroupUserArgs.builder()
    .apiManagementName("string")
    .groupName("string")
    .resourceGroupName("string")
    .userId("string")
    .build());
Copy
group_user_resource = azure.apimanagement.GroupUser("groupUserResource",
    api_management_name="string",
    group_name="string",
    resource_group_name="string",
    user_id="string")
Copy
const groupUserResource = new azure.apimanagement.GroupUser("groupUserResource", {
    apiManagementName: "string",
    groupName: "string",
    resourceGroupName: "string",
    userId: "string",
});
Copy
type: azure:apimanagement:GroupUser
properties:
    apiManagementName: string
    groupName: string
    resourceGroupName: string
    userId: string
Copy

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

ApiManagementName
This property is required.
Changes to this property will trigger replacement.
string
The name of the API Management Service. Changing this forces a new resource to be created.
GroupName
This property is required.
Changes to this property will trigger replacement.
string
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
UserId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the API Management User which should be assigned to this API Management Group. Changing this forces a new resource to be created.
ApiManagementName
This property is required.
Changes to this property will trigger replacement.
string
The name of the API Management Service. Changing this forces a new resource to be created.
GroupName
This property is required.
Changes to this property will trigger replacement.
string
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
UserId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the API Management User which should be assigned to this API Management Group. Changing this forces a new resource to be created.
apiManagementName
This property is required.
Changes to this property will trigger replacement.
String
The name of the API Management Service. Changing this forces a new resource to be created.
groupName
This property is required.
Changes to this property will trigger replacement.
String
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
userId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the API Management User which should be assigned to this API Management Group. Changing this forces a new resource to be created.
apiManagementName
This property is required.
Changes to this property will trigger replacement.
string
The name of the API Management Service. Changing this forces a new resource to be created.
groupName
This property is required.
Changes to this property will trigger replacement.
string
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
userId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the API Management User which should be assigned to this API Management Group. Changing this forces a new resource to be created.
api_management_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the API Management Service. Changing this forces a new resource to be created.
group_name
This property is required.
Changes to this property will trigger replacement.
str
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
user_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the API Management User which should be assigned to this API Management Group. Changing this forces a new resource to be created.
apiManagementName
This property is required.
Changes to this property will trigger replacement.
String
The name of the API Management Service. Changing this forces a new resource to be created.
groupName
This property is required.
Changes to this property will trigger replacement.
String
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
userId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the API Management User which should be assigned to this API Management Group. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the GroupUser 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 GroupUser Resource

Get an existing GroupUser 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?: GroupUserState, opts?: CustomResourceOptions): GroupUser
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        api_management_name: Optional[str] = None,
        group_name: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        user_id: Optional[str] = None) -> GroupUser
func GetGroupUser(ctx *Context, name string, id IDInput, state *GroupUserState, opts ...ResourceOption) (*GroupUser, error)
public static GroupUser Get(string name, Input<string> id, GroupUserState? state, CustomResourceOptions? opts = null)
public static GroupUser get(String name, Output<String> id, GroupUserState state, CustomResourceOptions options)
resources:  _:    type: azure:apimanagement:GroupUser    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
ApiManagementName Changes to this property will trigger replacement. string
The name of the API Management Service. Changing this forces a new resource to be created.
GroupName Changes to this property will trigger replacement. string
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
UserId Changes to this property will trigger replacement. string
The ID of the API Management User which should be assigned to this API Management Group. Changing this forces a new resource to be created.
ApiManagementName Changes to this property will trigger replacement. string
The name of the API Management Service. Changing this forces a new resource to be created.
GroupName Changes to this property will trigger replacement. string
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
UserId Changes to this property will trigger replacement. string
The ID of the API Management User which should be assigned to this API Management Group. Changing this forces a new resource to be created.
apiManagementName Changes to this property will trigger replacement. String
The name of the API Management Service. Changing this forces a new resource to be created.
groupName Changes to this property will trigger replacement. String
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
userId Changes to this property will trigger replacement. String
The ID of the API Management User which should be assigned to this API Management Group. Changing this forces a new resource to be created.
apiManagementName Changes to this property will trigger replacement. string
The name of the API Management Service. Changing this forces a new resource to be created.
groupName Changes to this property will trigger replacement. string
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. string
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
userId Changes to this property will trigger replacement. string
The ID of the API Management User which should be assigned to this API Management Group. Changing this forces a new resource to be created.
api_management_name Changes to this property will trigger replacement. str
The name of the API Management Service. Changing this forces a new resource to be created.
group_name Changes to this property will trigger replacement. str
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
resource_group_name Changes to this property will trigger replacement. str
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
user_id Changes to this property will trigger replacement. str
The ID of the API Management User which should be assigned to this API Management Group. Changing this forces a new resource to be created.
apiManagementName Changes to this property will trigger replacement. String
The name of the API Management Service. Changing this forces a new resource to be created.
groupName Changes to this property will trigger replacement. String
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
userId Changes to this property will trigger replacement. String
The ID of the API Management User which should be assigned to this API Management Group. Changing this forces a new resource to be created.

Import

API Management Group Users can be imported using the resource id, e.g.

$ pulumi import azure:apimanagement/groupUser:GroupUser example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/groups/groupId/users/user123
Copy

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.