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

We recommend using Azure Native.

Azure Classic v5.84.0 published on Tuesday, Jul 16, 2024 by Pulumi

azure.apimanagement.GroupUser

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.84.0 published on Tuesday, Jul 16, 2024 by Pulumi

    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),
    });
    
    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)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/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
    	})
    }
    
    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),
        });
    
    });
    
    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());
    
        }
    }
    
    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
    

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

    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

    The GroupUser resource accepts the following input properties:

    ApiManagementName string
    The name of the API Management Service. Changing this forces a new resource to be created.
    GroupName string
    The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    UserId 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 string
    The name of the API Management Service. Changing this forces a new resource to be created.
    GroupName string
    The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    UserId 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 String
    The name of the API Management Service. Changing this forces a new resource to be created.
    groupName String
    The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    userId 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 string
    The name of the API Management Service. Changing this forces a new resource to be created.
    groupName string
    The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    userId 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 str
    The name of the API Management Service. Changing this forces a new resource to be created.
    group_name 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 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 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 String
    The name of the API Management Service. Changing this forces a new resource to be created.
    groupName String
    The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    userId 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)
    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:
    ApiManagementName string
    The name of the API Management Service. Changing this forces a new resource to be created.
    GroupName string
    The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    UserId 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 string
    The name of the API Management Service. Changing this forces a new resource to be created.
    GroupName string
    The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    UserId 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 String
    The name of the API Management Service. Changing this forces a new resource to be created.
    groupName String
    The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    userId 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 string
    The name of the API Management Service. Changing this forces a new resource to be created.
    groupName string
    The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    userId 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 str
    The name of the API Management Service. Changing this forces a new resource to be created.
    group_name 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 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 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 String
    The name of the API Management Service. Changing this forces a new resource to be created.
    groupName String
    The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    userId 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
    

    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.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.84.0 published on Tuesday, Jul 16, 2024 by Pulumi