1. Packages
  2. MSSQL
  3. API Docs
  4. ServerRole
Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse

mssql.ServerRole

Explore with Pulumi AI

mssql logo
Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse

    Manages server-level role.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Mssql = Pulumiverse.Mssql;
    
    return await Deployment.RunAsync(() => 
    {
        var owner = new Mssql.ServerRole("owner");
    
        var example = new Mssql.ServerRole("example", new()
        {
            OwnerId = owner.Id,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-mssql/sdk/go/mssql"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		owner, err := mssql.NewServerRole(ctx, "owner", nil)
    		if err != nil {
    			return err
    		}
    		_, err = mssql.NewServerRole(ctx, "example", &mssql.ServerRoleArgs{
    			OwnerId: owner.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.mssql.ServerRole;
    import com.pulumi.mssql.ServerRoleArgs;
    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 owner = new ServerRole("owner");
    
            var example = new ServerRole("example", ServerRoleArgs.builder()        
                .ownerId(owner.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumiverse_mssql as mssql
    
    owner = mssql.ServerRole("owner")
    example = mssql.ServerRole("example", owner_id=owner.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as mssql from "@pulumiverse/mssql";
    
    const owner = new mssql.ServerRole("owner", {});
    const example = new mssql.ServerRole("example", {ownerId: owner.id});
    
    resources:
      owner:
        type: mssql:ServerRole
      example:
        type: mssql:ServerRole
        properties:
          ownerId: ${owner.id}
    

    Create ServerRole Resource

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

    Constructor syntax

    new ServerRole(name: string, args?: ServerRoleArgs, opts?: CustomResourceOptions);
    @overload
    def ServerRole(resource_name: str,
                   args: Optional[ServerRoleArgs] = None,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServerRole(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   name: Optional[str] = None,
                   owner_id: Optional[str] = None)
    func NewServerRole(ctx *Context, name string, args *ServerRoleArgs, opts ...ResourceOption) (*ServerRole, error)
    public ServerRole(string name, ServerRoleArgs? args = null, CustomResourceOptions? opts = null)
    public ServerRole(String name, ServerRoleArgs args)
    public ServerRole(String name, ServerRoleArgs args, CustomResourceOptions options)
    
    type: mssql:ServerRole
    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 ServerRoleArgs
    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 ServerRoleArgs
    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 ServerRoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServerRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServerRoleArgs
    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 serverRoleResource = new Mssql.ServerRole("serverRoleResource", new()
    {
        Name = "string",
        OwnerId = "string",
    });
    
    example, err := mssql.NewServerRole(ctx, "serverRoleResource", &mssql.ServerRoleArgs{
    	Name:    pulumi.String("string"),
    	OwnerId: pulumi.String("string"),
    })
    
    var serverRoleResource = new ServerRole("serverRoleResource", ServerRoleArgs.builder()
        .name("string")
        .ownerId("string")
        .build());
    
    server_role_resource = mssql.ServerRole("serverRoleResource",
        name="string",
        owner_id="string")
    
    const serverRoleResource = new mssql.ServerRole("serverRoleResource", {
        name: "string",
        ownerId: "string",
    });
    
    type: mssql:ServerRole
    properties:
        name: string
        ownerId: string
    

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

    Name string
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars.
    OwnerId string
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    Name string
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars.
    OwnerId string
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    name String
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars.
    ownerId String
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    name string
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars.
    ownerId string
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    name str
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars.
    owner_id str
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    name String
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars.
    ownerId String
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.

    Outputs

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

    Get an existing ServerRole 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?: ServerRoleState, opts?: CustomResourceOptions): ServerRole
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            owner_id: Optional[str] = None) -> ServerRole
    func GetServerRole(ctx *Context, name string, id IDInput, state *ServerRoleState, opts ...ResourceOption) (*ServerRole, error)
    public static ServerRole Get(string name, Input<string> id, ServerRoleState? state, CustomResourceOptions? opts = null)
    public static ServerRole get(String name, Output<String> id, ServerRoleState 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:
    Name string
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars.
    OwnerId string
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    Name string
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars.
    OwnerId string
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    name String
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars.
    ownerId String
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    name string
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars.
    ownerId string
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    name str
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars.
    owner_id str
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    name String
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars.
    ownerId String
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.

    Import

    import using <role_id> - can be retrieved using SELECT [principal_id] FROM sys.server_principals WHERE [name]='<role_name>'

     $ pulumi import mssql:index/serverRole:ServerRole example 7
    

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

    Package Details

    Repository
    mssql pulumiverse/pulumi-mssql
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the mssql Terraform Provider.
    mssql logo
    Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse