1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. cloudsso
  5. getUsers
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.cloudsso.getUsers

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

This data source provides the Cloud Sso Users of the current Alibaba Cloud user.

NOTE: Available in v1.140.0+.

NOTE: Cloud SSO Only Support cn-shanghai And us-west-1 Region

Example Usage

Basic Usage

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

const ids = alicloud.cloudsso.getUsers({
    directoryId: "example_value",
    ids: [
        "example_value-1",
        "example_value-2",
    ],
});
export const cloudSsoUserId1 = ids.then(ids => ids.users?.[0]?.id);
const nameRegex = alicloud.cloudsso.getUsers({
    directoryId: "example_value",
    nameRegex: "^my-User",
});
export const cloudSsoUserId2 = nameRegex.then(nameRegex => nameRegex.users?.[0]?.id);
const provisionType = alicloud.cloudsso.getUsers({
    directoryId: "example_value",
    ids: ["example_value-1"],
    provisionType: "Manual",
});
export const cloudSsoUserId3 = provisionType.then(provisionType => provisionType.users?.[0]?.id);
const status = alicloud.cloudsso.getUsers({
    directoryId: "example_value",
    ids: ["example_value-1"],
    status: "Enabled",
});
export const cloudSsoUserId4 = status.then(status => status.users?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.cloudsso.get_users(directory_id="example_value",
    ids=[
        "example_value-1",
        "example_value-2",
    ])
pulumi.export("cloudSsoUserId1", ids.users[0].id)
name_regex = alicloud.cloudsso.get_users(directory_id="example_value",
    name_regex="^my-User")
pulumi.export("cloudSsoUserId2", name_regex.users[0].id)
provision_type = alicloud.cloudsso.get_users(directory_id="example_value",
    ids=["example_value-1"],
    provision_type="Manual")
pulumi.export("cloudSsoUserId3", provision_type.users[0].id)
status = alicloud.cloudsso.get_users(directory_id="example_value",
    ids=["example_value-1"],
    status="Enabled")
pulumi.export("cloudSsoUserId4", status.users[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cloudsso"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ids, err := cloudsso.GetUsers(ctx, &cloudsso.GetUsersArgs{
			DirectoryId: "example_value",
			Ids: []string{
				"example_value-1",
				"example_value-2",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("cloudSsoUserId1", ids.Users[0].Id)
		nameRegex, err := cloudsso.GetUsers(ctx, &cloudsso.GetUsersArgs{
			DirectoryId: "example_value",
			NameRegex:   pulumi.StringRef("^my-User"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("cloudSsoUserId2", nameRegex.Users[0].Id)
		provisionType, err := cloudsso.GetUsers(ctx, &cloudsso.GetUsersArgs{
			DirectoryId: "example_value",
			Ids: []string{
				"example_value-1",
			},
			ProvisionType: pulumi.StringRef("Manual"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("cloudSsoUserId3", provisionType.Users[0].Id)
		status, err := cloudsso.GetUsers(ctx, &cloudsso.GetUsersArgs{
			DirectoryId: "example_value",
			Ids: []string{
				"example_value-1",
			},
			Status: pulumi.StringRef("Enabled"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("cloudSsoUserId4", status.Users[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.CloudSso.GetUsers.Invoke(new()
    {
        DirectoryId = "example_value",
        Ids = new[]
        {
            "example_value-1",
            "example_value-2",
        },
    });

    var nameRegex = AliCloud.CloudSso.GetUsers.Invoke(new()
    {
        DirectoryId = "example_value",
        NameRegex = "^my-User",
    });

    var provisionType = AliCloud.CloudSso.GetUsers.Invoke(new()
    {
        DirectoryId = "example_value",
        Ids = new[]
        {
            "example_value-1",
        },
        ProvisionType = "Manual",
    });

    var status = AliCloud.CloudSso.GetUsers.Invoke(new()
    {
        DirectoryId = "example_value",
        Ids = new[]
        {
            "example_value-1",
        },
        Status = "Enabled",
    });

    return new Dictionary<string, object?>
    {
        ["cloudSsoUserId1"] = ids.Apply(getUsersResult => getUsersResult.Users[0]?.Id),
        ["cloudSsoUserId2"] = nameRegex.Apply(getUsersResult => getUsersResult.Users[0]?.Id),
        ["cloudSsoUserId3"] = provisionType.Apply(getUsersResult => getUsersResult.Users[0]?.Id),
        ["cloudSsoUserId4"] = status.Apply(getUsersResult => getUsersResult.Users[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cloudsso.CloudssoFunctions;
import com.pulumi.alicloud.cloudsso.inputs.GetUsersArgs;
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 ids = CloudssoFunctions.getUsers(GetUsersArgs.builder()
            .directoryId("example_value")
            .ids(            
                "example_value-1",
                "example_value-2")
            .build());

        ctx.export("cloudSsoUserId1", ids.applyValue(getUsersResult -> getUsersResult.users()[0].id()));
        final var nameRegex = CloudssoFunctions.getUsers(GetUsersArgs.builder()
            .directoryId("example_value")
            .nameRegex("^my-User")
            .build());

        ctx.export("cloudSsoUserId2", nameRegex.applyValue(getUsersResult -> getUsersResult.users()[0].id()));
        final var provisionType = CloudssoFunctions.getUsers(GetUsersArgs.builder()
            .directoryId("example_value")
            .ids("example_value-1")
            .provisionType("Manual")
            .build());

        ctx.export("cloudSsoUserId3", provisionType.applyValue(getUsersResult -> getUsersResult.users()[0].id()));
        final var status = CloudssoFunctions.getUsers(GetUsersArgs.builder()
            .directoryId("example_value")
            .ids("example_value-1")
            .status("Enabled")
            .build());

        ctx.export("cloudSsoUserId4", status.applyValue(getUsersResult -> getUsersResult.users()[0].id()));
    }
}
Copy
variables:
  ids:
    fn::invoke:
      function: alicloud:cloudsso:getUsers
      arguments:
        directoryId: example_value
        ids:
          - example_value-1
          - example_value-2
  nameRegex:
    fn::invoke:
      function: alicloud:cloudsso:getUsers
      arguments:
        directoryId: example_value
        nameRegex: ^my-User
  provisionType:
    fn::invoke:
      function: alicloud:cloudsso:getUsers
      arguments:
        directoryId: example_value
        ids:
          - example_value-1
        provisionType: Manual
  status:
    fn::invoke:
      function: alicloud:cloudsso:getUsers
      arguments:
        directoryId: example_value
        ids:
          - example_value-1
        status: Enabled
outputs:
  cloudSsoUserId1: ${ids.users[0].id}
  cloudSsoUserId2: ${nameRegex.users[0].id}
  cloudSsoUserId3: ${provisionType.users[0].id}
  cloudSsoUserId4: ${status.users[0].id}
Copy

Using getUsers

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getUsers(args: GetUsersArgs, opts?: InvokeOptions): Promise<GetUsersResult>
function getUsersOutput(args: GetUsersOutputArgs, opts?: InvokeOptions): Output<GetUsersResult>
Copy
def get_users(directory_id: Optional[str] = None,
              enable_details: Optional[bool] = None,
              ids: Optional[Sequence[str]] = None,
              name_regex: Optional[str] = None,
              output_file: Optional[str] = None,
              provision_type: Optional[str] = None,
              status: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> GetUsersResult
def get_users_output(directory_id: Optional[pulumi.Input[str]] = None,
              enable_details: Optional[pulumi.Input[bool]] = None,
              ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
              name_regex: Optional[pulumi.Input[str]] = None,
              output_file: Optional[pulumi.Input[str]] = None,
              provision_type: Optional[pulumi.Input[str]] = None,
              status: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[GetUsersResult]
Copy
func GetUsers(ctx *Context, args *GetUsersArgs, opts ...InvokeOption) (*GetUsersResult, error)
func GetUsersOutput(ctx *Context, args *GetUsersOutputArgs, opts ...InvokeOption) GetUsersResultOutput
Copy

> Note: This function is named GetUsers in the Go SDK.

public static class GetUsers 
{
    public static Task<GetUsersResult> InvokeAsync(GetUsersArgs args, InvokeOptions? opts = null)
    public static Output<GetUsersResult> Invoke(GetUsersInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
public static Output<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:cloudsso/getUsers:getUsers
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

DirectoryId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Directory.
EnableDetails bool
Default to false. Set it to true can output more details about resource attributes.
Ids Changes to this property will trigger replacement. List<string>
A list of User IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by User name.
OutputFile string
File name where to save data source results (after running pulumi preview).
ProvisionType Changes to this property will trigger replacement. string
ProvisionType. Valid values: Manual, Synchronized.
Status Changes to this property will trigger replacement. string
The status of user. Valid values: Disabled, Enabled.
DirectoryId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Directory.
EnableDetails bool
Default to false. Set it to true can output more details about resource attributes.
Ids Changes to this property will trigger replacement. []string
A list of User IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by User name.
OutputFile string
File name where to save data source results (after running pulumi preview).
ProvisionType Changes to this property will trigger replacement. string
ProvisionType. Valid values: Manual, Synchronized.
Status Changes to this property will trigger replacement. string
The status of user. Valid values: Disabled, Enabled.
directoryId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Directory.
enableDetails Boolean
Default to false. Set it to true can output more details about resource attributes.
ids Changes to this property will trigger replacement. List<String>
A list of User IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by User name.
outputFile String
File name where to save data source results (after running pulumi preview).
provisionType Changes to this property will trigger replacement. String
ProvisionType. Valid values: Manual, Synchronized.
status Changes to this property will trigger replacement. String
The status of user. Valid values: Disabled, Enabled.
directoryId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Directory.
enableDetails boolean
Default to false. Set it to true can output more details about resource attributes.
ids Changes to this property will trigger replacement. string[]
A list of User IDs.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by User name.
outputFile string
File name where to save data source results (after running pulumi preview).
provisionType Changes to this property will trigger replacement. string
ProvisionType. Valid values: Manual, Synchronized.
status Changes to this property will trigger replacement. string
The status of user. Valid values: Disabled, Enabled.
directory_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the Directory.
enable_details bool
Default to false. Set it to true can output more details about resource attributes.
ids Changes to this property will trigger replacement. Sequence[str]
A list of User IDs.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by User name.
output_file str
File name where to save data source results (after running pulumi preview).
provision_type Changes to this property will trigger replacement. str
ProvisionType. Valid values: Manual, Synchronized.
status Changes to this property will trigger replacement. str
The status of user. Valid values: Disabled, Enabled.
directoryId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Directory.
enableDetails Boolean
Default to false. Set it to true can output more details about resource attributes.
ids Changes to this property will trigger replacement. List<String>
A list of User IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by User name.
outputFile String
File name where to save data source results (after running pulumi preview).
provisionType Changes to this property will trigger replacement. String
ProvisionType. Valid values: Manual, Synchronized.
status Changes to this property will trigger replacement. String
The status of user. Valid values: Disabled, Enabled.

getUsers Result

The following output properties are available:

DirectoryId string
Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Names List<string>
Users List<Pulumi.AliCloud.CloudSso.Outputs.GetUsersUser>
EnableDetails bool
NameRegex string
OutputFile string
ProvisionType string
Status string
DirectoryId string
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Names []string
Users []GetUsersUser
EnableDetails bool
NameRegex string
OutputFile string
ProvisionType string
Status string
directoryId String
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
users List<GetUsersUser>
enableDetails Boolean
nameRegex String
outputFile String
provisionType String
status String
directoryId string
id string
The provider-assigned unique ID for this managed resource.
ids string[]
names string[]
users GetUsersUser[]
enableDetails boolean
nameRegex string
outputFile string
provisionType string
status string
directory_id str
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
names Sequence[str]
users Sequence[GetUsersUser]
enable_details bool
name_regex str
output_file str
provision_type str
status str
directoryId String
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
users List<Property Map>
enableDetails Boolean
nameRegex String
outputFile String
provisionType String
status String

Supporting Types

GetUsersUser

CreateTime This property is required. string
The create time of the user.
Description This property is required. string
The description of user.
DirectoryId This property is required. string
The ID of the Directory.
DisplayName This property is required. string
The display name of user.
Email This property is required. string
The User's Contact Email Address.
FirstName This property is required. string
The first name of user.
Id This property is required. string
The ID of the User.
LastName This property is required. string
The last name of user.
MfaDevices This property is required. List<Pulumi.AliCloud.CloudSso.Inputs.GetUsersUserMfaDevice>
The List of MFA Device for User.
ProvisionType This property is required. string
ProvisionType.
Status This property is required. string
User status. Valid values: Enabled and Disabled.
UserId This property is required. string
The User ID of the group.
UserName This property is required. string
The name of user.
CreateTime This property is required. string
The create time of the user.
Description This property is required. string
The description of user.
DirectoryId This property is required. string
The ID of the Directory.
DisplayName This property is required. string
The display name of user.
Email This property is required. string
The User's Contact Email Address.
FirstName This property is required. string
The first name of user.
Id This property is required. string
The ID of the User.
LastName This property is required. string
The last name of user.
MfaDevices This property is required. []GetUsersUserMfaDevice
The List of MFA Device for User.
ProvisionType This property is required. string
ProvisionType.
Status This property is required. string
User status. Valid values: Enabled and Disabled.
UserId This property is required. string
The User ID of the group.
UserName This property is required. string
The name of user.
createTime This property is required. String
The create time of the user.
description This property is required. String
The description of user.
directoryId This property is required. String
The ID of the Directory.
displayName This property is required. String
The display name of user.
email This property is required. String
The User's Contact Email Address.
firstName This property is required. String
The first name of user.
id This property is required. String
The ID of the User.
lastName This property is required. String
The last name of user.
mfaDevices This property is required. List<GetUsersUserMfaDevice>
The List of MFA Device for User.
provisionType This property is required. String
ProvisionType.
status This property is required. String
User status. Valid values: Enabled and Disabled.
userId This property is required. String
The User ID of the group.
userName This property is required. String
The name of user.
createTime This property is required. string
The create time of the user.
description This property is required. string
The description of user.
directoryId This property is required. string
The ID of the Directory.
displayName This property is required. string
The display name of user.
email This property is required. string
The User's Contact Email Address.
firstName This property is required. string
The first name of user.
id This property is required. string
The ID of the User.
lastName This property is required. string
The last name of user.
mfaDevices This property is required. GetUsersUserMfaDevice[]
The List of MFA Device for User.
provisionType This property is required. string
ProvisionType.
status This property is required. string
User status. Valid values: Enabled and Disabled.
userId This property is required. string
The User ID of the group.
userName This property is required. string
The name of user.
create_time This property is required. str
The create time of the user.
description This property is required. str
The description of user.
directory_id This property is required. str
The ID of the Directory.
display_name This property is required. str
The display name of user.
email This property is required. str
The User's Contact Email Address.
first_name This property is required. str
The first name of user.
id This property is required. str
The ID of the User.
last_name This property is required. str
The last name of user.
mfa_devices This property is required. Sequence[GetUsersUserMfaDevice]
The List of MFA Device for User.
provision_type This property is required. str
ProvisionType.
status This property is required. str
User status. Valid values: Enabled and Disabled.
user_id This property is required. str
The User ID of the group.
user_name This property is required. str
The name of user.
createTime This property is required. String
The create time of the user.
description This property is required. String
The description of user.
directoryId This property is required. String
The ID of the Directory.
displayName This property is required. String
The display name of user.
email This property is required. String
The User's Contact Email Address.
firstName This property is required. String
The first name of user.
id This property is required. String
The ID of the User.
lastName This property is required. String
The last name of user.
mfaDevices This property is required. List<Property Map>
The List of MFA Device for User.
provisionType This property is required. String
ProvisionType.
status This property is required. String
User status. Valid values: Enabled and Disabled.
userId This property is required. String
The User ID of the group.
userName This property is required. String
The name of user.

GetUsersUserMfaDevice

DeviceId This property is required. string
The MFA Device ID.
DeviceName This property is required. string
The MFA Device Name.
DeviceType This property is required. string
The MFA Device Type.
EffectiveTime This property is required. string
The Effective Time of MFA Device.
DeviceId This property is required. string
The MFA Device ID.
DeviceName This property is required. string
The MFA Device Name.
DeviceType This property is required. string
The MFA Device Type.
EffectiveTime This property is required. string
The Effective Time of MFA Device.
deviceId This property is required. String
The MFA Device ID.
deviceName This property is required. String
The MFA Device Name.
deviceType This property is required. String
The MFA Device Type.
effectiveTime This property is required. String
The Effective Time of MFA Device.
deviceId This property is required. string
The MFA Device ID.
deviceName This property is required. string
The MFA Device Name.
deviceType This property is required. string
The MFA Device Type.
effectiveTime This property is required. string
The Effective Time of MFA Device.
device_id This property is required. str
The MFA Device ID.
device_name This property is required. str
The MFA Device Name.
device_type This property is required. str
The MFA Device Type.
effective_time This property is required. str
The Effective Time of MFA Device.
deviceId This property is required. String
The MFA Device ID.
deviceName This property is required. String
The MFA Device Name.
deviceType This property is required. String
The MFA Device Type.
effectiveTime This property is required. String
The Effective Time of MFA Device.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi