databricks logo
Databricks v1.14.0, May 23 23

databricks.getUser

Explore with Pulumi AI

Note If you have a fully automated setup with workspaces created by databricks_mws_workspaces, please make sure to add depends_on attribute in order to prevent default auth: cannot configure default credentials errors.

Retrieves information about databricks_user.

The following resources are used in the same context:

  • End to end workspace management guide.
  • databricks.getCurrentUser data to retrieve information about databricks.User or databricks_service_principal, that is calling Databricks REST API.
  • databricks.Group to manage groups in Databricks Workspace or Account Console (for AWS deployments).
  • databricks.Group data to retrieve information about databricks.Group members, entitlements and instance profiles.
  • databricks.GroupInstanceProfile to attach databricks.InstanceProfile (AWS) to databricks_group.
  • databricks.GroupMember to attach users and groups as group members.
  • databricks.Permissions to manage access control in Databricks workspace.
  • databricks.User to manage users, that could be added to databricks.Group within the workspace.
  • databricks.UserInstanceProfile to attach databricks.InstanceProfile (AWS) to databricks_user.

Example Usage

Adding user to administrative group

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

return await Deployment.RunAsync(() => 
{
    var admins = Databricks.GetGroup.Invoke(new()
    {
        DisplayName = "admins",
    });

    var me = Databricks.GetUser.Invoke(new()
    {
        UserName = "me@example.com",
    });

    var myMemberA = new Databricks.GroupMember("myMemberA", new()
    {
        GroupId = admins.Apply(getGroupResult => getGroupResult.Id),
        MemberId = me.Apply(getUserResult => getUserResult.Id),
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		admins, err := databricks.LookupGroup(ctx, &databricks.LookupGroupArgs{
			DisplayName: "admins",
		}, nil)
		if err != nil {
			return err
		}
		me, err := databricks.LookupUser(ctx, &databricks.LookupUserArgs{
			UserName: pulumi.StringRef("me@example.com"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = databricks.NewGroupMember(ctx, "myMemberA", &databricks.GroupMemberArgs{
			GroupId:  *pulumi.String(admins.Id),
			MemberId: *pulumi.String(me.Id),
		})
		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.databricks.DatabricksFunctions;
import com.pulumi.databricks.inputs.GetGroupArgs;
import com.pulumi.databricks.inputs.GetUserArgs;
import com.pulumi.databricks.GroupMember;
import com.pulumi.databricks.GroupMemberArgs;
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 admins = DatabricksFunctions.getGroup(GetGroupArgs.builder()
            .displayName("admins")
            .build());

        final var me = DatabricksFunctions.getUser(GetUserArgs.builder()
            .userName("me@example.com")
            .build());

        var myMemberA = new GroupMember("myMemberA", GroupMemberArgs.builder()        
            .groupId(admins.applyValue(getGroupResult -> getGroupResult.id()))
            .memberId(me.applyValue(getUserResult -> getUserResult.id()))
            .build());

    }
}
import pulumi
import pulumi_databricks as databricks

admins = databricks.get_group(display_name="admins")
me = databricks.get_user(user_name="me@example.com")
my_member_a = databricks.GroupMember("myMemberA",
    group_id=admins.id,
    member_id=me.id)
import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";

const admins = databricks.getGroup({
    displayName: "admins",
});
const me = databricks.getUser({
    userName: "me@example.com",
});
const myMemberA = new databricks.GroupMember("myMemberA", {
    groupId: admins.then(admins => admins.id),
    memberId: me.then(me => me.id),
});
resources:
  myMemberA:
    type: databricks:GroupMember
    properties:
      groupId: ${admins.id}
      memberId: ${me.id}
variables:
  admins:
    fn::invoke:
      Function: databricks:getGroup
      Arguments:
        displayName: admins
  me:
    fn::invoke:
      Function: databricks:getUser
      Arguments:
        userName: me@example.com

Using getUser

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 getUser(args: GetUserArgs, opts?: InvokeOptions): Promise<GetUserResult>
function getUserOutput(args: GetUserOutputArgs, opts?: InvokeOptions): Output<GetUserResult>
def get_user(user_id: Optional[str] = None,
             user_name: Optional[str] = None,
             opts: Optional[InvokeOptions] = None) -> GetUserResult
def get_user_output(user_id: Optional[pulumi.Input[str]] = None,
             user_name: Optional[pulumi.Input[str]] = None,
             opts: Optional[InvokeOptions] = None) -> Output[GetUserResult]
func LookupUser(ctx *Context, args *LookupUserArgs, opts ...InvokeOption) (*LookupUserResult, error)
func LookupUserOutput(ctx *Context, args *LookupUserOutputArgs, opts ...InvokeOption) LookupUserResultOutput

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

public static class GetUser 
{
    public static Task<GetUserResult> InvokeAsync(GetUserArgs args, InvokeOptions? opts = null)
    public static Output<GetUserResult> Invoke(GetUserInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetUserResult> getUser(GetUserArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: databricks:index/getUser:getUser
  arguments:
    # arguments dictionary

The following arguments are supported:

UserId string

ID of the user.

UserName string

User name of the user. The user must exist before this resource can be planned.

UserId string

ID of the user.

UserName string

User name of the user. The user must exist before this resource can be planned.

userId String

ID of the user.

userName String

User name of the user. The user must exist before this resource can be planned.

userId string

ID of the user.

userName string

User name of the user. The user must exist before this resource can be planned.

user_id str

ID of the user.

user_name str

User name of the user. The user must exist before this resource can be planned.

userId String

ID of the user.

userName String

User name of the user. The user must exist before this resource can be planned.

getUser Result

The following output properties are available:

Alphanumeric string

Alphanumeric representation of user local name. e.g. mr_foo.

ApplicationId string
DisplayName string

Display name of the user, e.g. Mr Foo.

ExternalId string

ID of the user in an external identity provider.

Home string

Home folder of the user, e.g. /Users/mr.foo@example.com.

Id string

The provider-assigned unique ID for this managed resource.

Repos string

Personal Repos location of the user, e.g. /Repos/mr.foo@example.com.

UserId string
UserName string

Name of the user, e.g. mr.foo@example.com.

Alphanumeric string

Alphanumeric representation of user local name. e.g. mr_foo.

ApplicationId string
DisplayName string

Display name of the user, e.g. Mr Foo.

ExternalId string

ID of the user in an external identity provider.

Home string

Home folder of the user, e.g. /Users/mr.foo@example.com.

Id string

The provider-assigned unique ID for this managed resource.

Repos string

Personal Repos location of the user, e.g. /Repos/mr.foo@example.com.

UserId string
UserName string

Name of the user, e.g. mr.foo@example.com.

alphanumeric String

Alphanumeric representation of user local name. e.g. mr_foo.

applicationId String
displayName String

Display name of the user, e.g. Mr Foo.

externalId String

ID of the user in an external identity provider.

home String

Home folder of the user, e.g. /Users/mr.foo@example.com.

id String

The provider-assigned unique ID for this managed resource.

repos String

Personal Repos location of the user, e.g. /Repos/mr.foo@example.com.

userId String
userName String

Name of the user, e.g. mr.foo@example.com.

alphanumeric string

Alphanumeric representation of user local name. e.g. mr_foo.

applicationId string
displayName string

Display name of the user, e.g. Mr Foo.

externalId string

ID of the user in an external identity provider.

home string

Home folder of the user, e.g. /Users/mr.foo@example.com.

id string

The provider-assigned unique ID for this managed resource.

repos string

Personal Repos location of the user, e.g. /Repos/mr.foo@example.com.

userId string
userName string

Name of the user, e.g. mr.foo@example.com.

alphanumeric str

Alphanumeric representation of user local name. e.g. mr_foo.

application_id str
display_name str

Display name of the user, e.g. Mr Foo.

external_id str

ID of the user in an external identity provider.

home str

Home folder of the user, e.g. /Users/mr.foo@example.com.

id str

The provider-assigned unique ID for this managed resource.

repos str

Personal Repos location of the user, e.g. /Repos/mr.foo@example.com.

user_id str
user_name str

Name of the user, e.g. mr.foo@example.com.

alphanumeric String

Alphanumeric representation of user local name. e.g. mr_foo.

applicationId String
displayName String

Display name of the user, e.g. Mr Foo.

externalId String

ID of the user in an external identity provider.

home String

Home folder of the user, e.g. /Users/mr.foo@example.com.

id String

The provider-assigned unique ID for this managed resource.

repos String

Personal Repos location of the user, e.g. /Repos/mr.foo@example.com.

userId String
userName String

Name of the user, e.g. mr.foo@example.com.

Package Details

Repository
databricks pulumi/pulumi-databricks
License
Apache-2.0
Notes

This Pulumi package is based on the databricks Terraform Provider.