1. Packages
  2. Databricks
  3. API Docs
  4. MwsPermissionAssignment
Databricks v1.56.0 published on Tuesday, Nov 12, 2024 by Pulumi

databricks.MwsPermissionAssignment

Explore with Pulumi AI

databricks logo
Databricks v1.56.0 published on Tuesday, Nov 12, 2024 by Pulumi

    These resources are invoked in the account context. Permission Assignment Account API endpoints are restricted to account admins. Provider must have account_id attribute configured. Account Id that could be found in the top right corner of Accounts Console

    Example Usage

    In account context, adding account-level group to a workspace:

    import * as pulumi from "@pulumi/pulumi";
    import * as databricks from "@pulumi/databricks";
    
    const dataEng = new databricks.Group("data_eng", {displayName: "Data Engineering"});
    const addAdminGroup = new databricks.MwsPermissionAssignment("add_admin_group", {
        workspaceId: _this.workspaceId,
        principalId: dataEng.id,
        permissions: ["ADMIN"],
    });
    
    import pulumi
    import pulumi_databricks as databricks
    
    data_eng = databricks.Group("data_eng", display_name="Data Engineering")
    add_admin_group = databricks.MwsPermissionAssignment("add_admin_group",
        workspace_id=this["workspaceId"],
        principal_id=data_eng.id,
        permissions=["ADMIN"])
    
    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 {
    		dataEng, err := databricks.NewGroup(ctx, "data_eng", &databricks.GroupArgs{
    			DisplayName: pulumi.String("Data Engineering"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = databricks.NewMwsPermissionAssignment(ctx, "add_admin_group", &databricks.MwsPermissionAssignmentArgs{
    			WorkspaceId: pulumi.Any(this.WorkspaceId),
    			PrincipalId: dataEng.ID(),
    			Permissions: pulumi.StringArray{
    				pulumi.String("ADMIN"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Databricks = Pulumi.Databricks;
    
    return await Deployment.RunAsync(() => 
    {
        var dataEng = new Databricks.Group("data_eng", new()
        {
            DisplayName = "Data Engineering",
        });
    
        var addAdminGroup = new Databricks.MwsPermissionAssignment("add_admin_group", new()
        {
            WorkspaceId = @this.WorkspaceId,
            PrincipalId = dataEng.Id,
            Permissions = new[]
            {
                "ADMIN",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.databricks.Group;
    import com.pulumi.databricks.GroupArgs;
    import com.pulumi.databricks.MwsPermissionAssignment;
    import com.pulumi.databricks.MwsPermissionAssignmentArgs;
    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 dataEng = new Group("dataEng", GroupArgs.builder()
                .displayName("Data Engineering")
                .build());
    
            var addAdminGroup = new MwsPermissionAssignment("addAdminGroup", MwsPermissionAssignmentArgs.builder()
                .workspaceId(this_.workspaceId())
                .principalId(dataEng.id())
                .permissions("ADMIN")
                .build());
    
        }
    }
    
    resources:
      dataEng:
        type: databricks:Group
        name: data_eng
        properties:
          displayName: Data Engineering
      addAdminGroup:
        type: databricks:MwsPermissionAssignment
        name: add_admin_group
        properties:
          workspaceId: ${this.workspaceId}
          principalId: ${dataEng.id}
          permissions:
            - ADMIN
    

    In account context, adding account-level user to a workspace:

    import * as pulumi from "@pulumi/pulumi";
    import * as databricks from "@pulumi/databricks";
    
    const me = new databricks.User("me", {userName: "me@example.com"});
    const addUser = new databricks.MwsPermissionAssignment("add_user", {
        workspaceId: _this.workspaceId,
        principalId: me.id,
        permissions: ["USER"],
    });
    
    import pulumi
    import pulumi_databricks as databricks
    
    me = databricks.User("me", user_name="me@example.com")
    add_user = databricks.MwsPermissionAssignment("add_user",
        workspace_id=this["workspaceId"],
        principal_id=me.id,
        permissions=["USER"])
    
    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 {
    		me, err := databricks.NewUser(ctx, "me", &databricks.UserArgs{
    			UserName: pulumi.String("me@example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = databricks.NewMwsPermissionAssignment(ctx, "add_user", &databricks.MwsPermissionAssignmentArgs{
    			WorkspaceId: pulumi.Any(this.WorkspaceId),
    			PrincipalId: me.ID(),
    			Permissions: pulumi.StringArray{
    				pulumi.String("USER"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Databricks = Pulumi.Databricks;
    
    return await Deployment.RunAsync(() => 
    {
        var me = new Databricks.User("me", new()
        {
            UserName = "me@example.com",
        });
    
        var addUser = new Databricks.MwsPermissionAssignment("add_user", new()
        {
            WorkspaceId = @this.WorkspaceId,
            PrincipalId = me.Id,
            Permissions = new[]
            {
                "USER",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.databricks.User;
    import com.pulumi.databricks.UserArgs;
    import com.pulumi.databricks.MwsPermissionAssignment;
    import com.pulumi.databricks.MwsPermissionAssignmentArgs;
    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 me = new User("me", UserArgs.builder()
                .userName("me@example.com")
                .build());
    
            var addUser = new MwsPermissionAssignment("addUser", MwsPermissionAssignmentArgs.builder()
                .workspaceId(this_.workspaceId())
                .principalId(me.id())
                .permissions("USER")
                .build());
    
        }
    }
    
    resources:
      me:
        type: databricks:User
        properties:
          userName: me@example.com
      addUser:
        type: databricks:MwsPermissionAssignment
        name: add_user
        properties:
          workspaceId: ${this.workspaceId}
          principalId: ${me.id}
          permissions:
            - USER
    

    In account context, adding account-level service principal to a workspace:

    import * as pulumi from "@pulumi/pulumi";
    import * as databricks from "@pulumi/databricks";
    
    const sp = new databricks.ServicePrincipal("sp", {displayName: "Automation-only SP"});
    const addAdminSpn = new databricks.MwsPermissionAssignment("add_admin_spn", {
        workspaceId: _this.workspaceId,
        principalId: sp.id,
        permissions: ["ADMIN"],
    });
    
    import pulumi
    import pulumi_databricks as databricks
    
    sp = databricks.ServicePrincipal("sp", display_name="Automation-only SP")
    add_admin_spn = databricks.MwsPermissionAssignment("add_admin_spn",
        workspace_id=this["workspaceId"],
        principal_id=sp.id,
        permissions=["ADMIN"])
    
    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 {
    		sp, err := databricks.NewServicePrincipal(ctx, "sp", &databricks.ServicePrincipalArgs{
    			DisplayName: pulumi.String("Automation-only SP"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = databricks.NewMwsPermissionAssignment(ctx, "add_admin_spn", &databricks.MwsPermissionAssignmentArgs{
    			WorkspaceId: pulumi.Any(this.WorkspaceId),
    			PrincipalId: sp.ID(),
    			Permissions: pulumi.StringArray{
    				pulumi.String("ADMIN"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Databricks = Pulumi.Databricks;
    
    return await Deployment.RunAsync(() => 
    {
        var sp = new Databricks.ServicePrincipal("sp", new()
        {
            DisplayName = "Automation-only SP",
        });
    
        var addAdminSpn = new Databricks.MwsPermissionAssignment("add_admin_spn", new()
        {
            WorkspaceId = @this.WorkspaceId,
            PrincipalId = sp.Id,
            Permissions = new[]
            {
                "ADMIN",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.databricks.ServicePrincipal;
    import com.pulumi.databricks.ServicePrincipalArgs;
    import com.pulumi.databricks.MwsPermissionAssignment;
    import com.pulumi.databricks.MwsPermissionAssignmentArgs;
    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 sp = new ServicePrincipal("sp", ServicePrincipalArgs.builder()
                .displayName("Automation-only SP")
                .build());
    
            var addAdminSpn = new MwsPermissionAssignment("addAdminSpn", MwsPermissionAssignmentArgs.builder()
                .workspaceId(this_.workspaceId())
                .principalId(sp.id())
                .permissions("ADMIN")
                .build());
    
        }
    }
    
    resources:
      sp:
        type: databricks:ServicePrincipal
        properties:
          displayName: Automation-only SP
      addAdminSpn:
        type: databricks:MwsPermissionAssignment
        name: add_admin_spn
        properties:
          workspaceId: ${this.workspaceId}
          principalId: ${sp.id}
          permissions:
            - ADMIN
    

    The following resources are used in the same context:

    • 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.GroupMember to attach users and groups as group members.
    • databricks.PermissionAssignment to manage permission assignment from a workspace context

    Create MwsPermissionAssignment Resource

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

    Constructor syntax

    new MwsPermissionAssignment(name: string, args: MwsPermissionAssignmentArgs, opts?: CustomResourceOptions);
    @overload
    def MwsPermissionAssignment(resource_name: str,
                                args: MwsPermissionAssignmentArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def MwsPermissionAssignment(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                permissions: Optional[Sequence[str]] = None,
                                principal_id: Optional[str] = None,
                                workspace_id: Optional[str] = None)
    func NewMwsPermissionAssignment(ctx *Context, name string, args MwsPermissionAssignmentArgs, opts ...ResourceOption) (*MwsPermissionAssignment, error)
    public MwsPermissionAssignment(string name, MwsPermissionAssignmentArgs args, CustomResourceOptions? opts = null)
    public MwsPermissionAssignment(String name, MwsPermissionAssignmentArgs args)
    public MwsPermissionAssignment(String name, MwsPermissionAssignmentArgs args, CustomResourceOptions options)
    
    type: databricks:MwsPermissionAssignment
    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 MwsPermissionAssignmentArgs
    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 MwsPermissionAssignmentArgs
    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 MwsPermissionAssignmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MwsPermissionAssignmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args MwsPermissionAssignmentArgs
    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 mwsPermissionAssignmentResource = new Databricks.MwsPermissionAssignment("mwsPermissionAssignmentResource", new()
    {
        Permissions = new[]
        {
            "string",
        },
        PrincipalId = "string",
        WorkspaceId = "string",
    });
    
    example, err := databricks.NewMwsPermissionAssignment(ctx, "mwsPermissionAssignmentResource", &databricks.MwsPermissionAssignmentArgs{
    	Permissions: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	PrincipalId: pulumi.String("string"),
    	WorkspaceId: pulumi.String("string"),
    })
    
    var mwsPermissionAssignmentResource = new MwsPermissionAssignment("mwsPermissionAssignmentResource", MwsPermissionAssignmentArgs.builder()
        .permissions("string")
        .principalId("string")
        .workspaceId("string")
        .build());
    
    mws_permission_assignment_resource = databricks.MwsPermissionAssignment("mwsPermissionAssignmentResource",
        permissions=["string"],
        principal_id="string",
        workspace_id="string")
    
    const mwsPermissionAssignmentResource = new databricks.MwsPermissionAssignment("mwsPermissionAssignmentResource", {
        permissions: ["string"],
        principalId: "string",
        workspaceId: "string",
    });
    
    type: databricks:MwsPermissionAssignment
    properties:
        permissions:
            - string
        principalId: string
        workspaceId: string
    

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

    Permissions List<string>
    The list of workspace permissions to assign to the principal:

    • "USER" - Can access the workspace with basic privileges.
    • "ADMIN" - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more.
    PrincipalId string
    Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the SCIM API, or using databricks_user, databricks.ServicePrincipal or databricks.Group data sources.
    WorkspaceId string
    Databricks workspace ID.
    Permissions []string
    The list of workspace permissions to assign to the principal:

    • "USER" - Can access the workspace with basic privileges.
    • "ADMIN" - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more.
    PrincipalId string
    Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the SCIM API, or using databricks_user, databricks.ServicePrincipal or databricks.Group data sources.
    WorkspaceId string
    Databricks workspace ID.
    permissions List<String>
    The list of workspace permissions to assign to the principal:

    • "USER" - Can access the workspace with basic privileges.
    • "ADMIN" - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more.
    principalId String
    Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the SCIM API, or using databricks_user, databricks.ServicePrincipal or databricks.Group data sources.
    workspaceId String
    Databricks workspace ID.
    permissions string[]
    The list of workspace permissions to assign to the principal:

    • "USER" - Can access the workspace with basic privileges.
    • "ADMIN" - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more.
    principalId string
    Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the SCIM API, or using databricks_user, databricks.ServicePrincipal or databricks.Group data sources.
    workspaceId string
    Databricks workspace ID.
    permissions Sequence[str]
    The list of workspace permissions to assign to the principal:

    • "USER" - Can access the workspace with basic privileges.
    • "ADMIN" - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more.
    principal_id str
    Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the SCIM API, or using databricks_user, databricks.ServicePrincipal or databricks.Group data sources.
    workspace_id str
    Databricks workspace ID.
    permissions List<String>
    The list of workspace permissions to assign to the principal:

    • "USER" - Can access the workspace with basic privileges.
    • "ADMIN" - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more.
    principalId String
    Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the SCIM API, or using databricks_user, databricks.ServicePrincipal or databricks.Group data sources.
    workspaceId String
    Databricks workspace ID.

    Outputs

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

    Get an existing MwsPermissionAssignment 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?: MwsPermissionAssignmentState, opts?: CustomResourceOptions): MwsPermissionAssignment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            permissions: Optional[Sequence[str]] = None,
            principal_id: Optional[str] = None,
            workspace_id: Optional[str] = None) -> MwsPermissionAssignment
    func GetMwsPermissionAssignment(ctx *Context, name string, id IDInput, state *MwsPermissionAssignmentState, opts ...ResourceOption) (*MwsPermissionAssignment, error)
    public static MwsPermissionAssignment Get(string name, Input<string> id, MwsPermissionAssignmentState? state, CustomResourceOptions? opts = null)
    public static MwsPermissionAssignment get(String name, Output<String> id, MwsPermissionAssignmentState 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:
    Permissions List<string>
    The list of workspace permissions to assign to the principal:

    • "USER" - Can access the workspace with basic privileges.
    • "ADMIN" - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more.
    PrincipalId string
    Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the SCIM API, or using databricks_user, databricks.ServicePrincipal or databricks.Group data sources.
    WorkspaceId string
    Databricks workspace ID.
    Permissions []string
    The list of workspace permissions to assign to the principal:

    • "USER" - Can access the workspace with basic privileges.
    • "ADMIN" - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more.
    PrincipalId string
    Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the SCIM API, or using databricks_user, databricks.ServicePrincipal or databricks.Group data sources.
    WorkspaceId string
    Databricks workspace ID.
    permissions List<String>
    The list of workspace permissions to assign to the principal:

    • "USER" - Can access the workspace with basic privileges.
    • "ADMIN" - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more.
    principalId String
    Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the SCIM API, or using databricks_user, databricks.ServicePrincipal or databricks.Group data sources.
    workspaceId String
    Databricks workspace ID.
    permissions string[]
    The list of workspace permissions to assign to the principal:

    • "USER" - Can access the workspace with basic privileges.
    • "ADMIN" - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more.
    principalId string
    Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the SCIM API, or using databricks_user, databricks.ServicePrincipal or databricks.Group data sources.
    workspaceId string
    Databricks workspace ID.
    permissions Sequence[str]
    The list of workspace permissions to assign to the principal:

    • "USER" - Can access the workspace with basic privileges.
    • "ADMIN" - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more.
    principal_id str
    Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the SCIM API, or using databricks_user, databricks.ServicePrincipal or databricks.Group data sources.
    workspace_id str
    Databricks workspace ID.
    permissions List<String>
    The list of workspace permissions to assign to the principal:

    • "USER" - Can access the workspace with basic privileges.
    • "ADMIN" - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more.
    principalId String
    Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the SCIM API, or using databricks_user, databricks.ServicePrincipal or databricks.Group data sources.
    workspaceId String
    Databricks workspace ID.

    Import

    The resource databricks_mws_permission_assignment can be imported using the workspace id and principal id

    bash

    $ pulumi import databricks:index/mwsPermissionAssignment:MwsPermissionAssignment this "workspace_id|principal_id"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    databricks pulumi/pulumi-databricks
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the databricks Terraform Provider.
    databricks logo
    Databricks v1.56.0 published on Tuesday, Nov 12, 2024 by Pulumi