mssql.ServerRoleMember
Explore with Pulumi AI
Manages server role membership.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as mssql from "@pulumi/mssql";
import * as mssql from "@pulumiverse/mssql";
const member = mssql.getSqlLogin({
name: "member_login",
});
const exampleServerRole = new mssql.ServerRole("exampleServerRole", {});
const exampleServerRoleMember = new mssql.ServerRoleMember("exampleServerRoleMember", {
roleId: exampleServerRole.id,
memberId: member.then(member => member.id),
});
import pulumi
import pulumi_mssql as mssql
import pulumiverse_mssql as mssql
member = mssql.get_sql_login(name="member_login")
example_server_role = mssql.ServerRole("exampleServerRole")
example_server_role_member = mssql.ServerRoleMember("exampleServerRoleMember",
role_id=example_server_role.id,
member_id=member.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 {
member, err := mssql.LookupSqlLogin(ctx, &mssql.LookupSqlLoginArgs{
Name: "member_login",
}, nil)
if err != nil {
return err
}
exampleServerRole, err := mssql.NewServerRole(ctx, "exampleServerRole", nil)
if err != nil {
return err
}
_, err = mssql.NewServerRoleMember(ctx, "exampleServerRoleMember", &mssql.ServerRoleMemberArgs{
RoleId: exampleServerRole.ID(),
MemberId: pulumi.String(member.Id),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mssql = Pulumi.Mssql;
using Mssql = Pulumiverse.Mssql;
return await Deployment.RunAsync(() =>
{
var member = Mssql.GetSqlLogin.Invoke(new()
{
Name = "member_login",
});
var exampleServerRole = new Mssql.ServerRole("exampleServerRole");
var exampleServerRoleMember = new Mssql.ServerRoleMember("exampleServerRoleMember", new()
{
RoleId = exampleServerRole.Id,
MemberId = member.Apply(getSqlLoginResult => getSqlLoginResult.Id),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mssql.MssqlFunctions;
import com.pulumi.mssql.inputs.GetSqlLoginArgs;
import com.pulumi.mssql.ServerRole;
import com.pulumi.mssql.ServerRoleMember;
import com.pulumi.mssql.ServerRoleMemberArgs;
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 member = MssqlFunctions.getSqlLogin(GetSqlLoginArgs.builder()
.name("member_login")
.build());
var exampleServerRole = new ServerRole("exampleServerRole");
var exampleServerRoleMember = new ServerRoleMember("exampleServerRoleMember", ServerRoleMemberArgs.builder()
.roleId(exampleServerRole.id())
.memberId(member.applyValue(getSqlLoginResult -> getSqlLoginResult.id()))
.build());
}
}
resources:
exampleServerRole:
type: mssql:ServerRole
exampleServerRoleMember:
type: mssql:ServerRoleMember
properties:
roleId: ${exampleServerRole.id}
memberId: ${member.id}
variables:
member:
fn::invoke:
Function: mssql:getSqlLogin
Arguments:
name: member_login
Create ServerRoleMember Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ServerRoleMember(name: string, args: ServerRoleMemberArgs, opts?: CustomResourceOptions);
@overload
def ServerRoleMember(resource_name: str,
args: ServerRoleMemberArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ServerRoleMember(resource_name: str,
opts: Optional[ResourceOptions] = None,
member_id: Optional[str] = None,
role_id: Optional[str] = None)
func NewServerRoleMember(ctx *Context, name string, args ServerRoleMemberArgs, opts ...ResourceOption) (*ServerRoleMember, error)
public ServerRoleMember(string name, ServerRoleMemberArgs args, CustomResourceOptions? opts = null)
public ServerRoleMember(String name, ServerRoleMemberArgs args)
public ServerRoleMember(String name, ServerRoleMemberArgs args, CustomResourceOptions options)
type: mssql:ServerRoleMember
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 ServerRoleMemberArgs
- 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 ServerRoleMemberArgs
- 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 ServerRoleMemberArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServerRoleMemberArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ServerRoleMemberArgs
- 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 serverRoleMemberResource = new Mssql.ServerRoleMember("serverRoleMemberResource", new()
{
MemberId = "string",
RoleId = "string",
});
example, err := mssql.NewServerRoleMember(ctx, "serverRoleMemberResource", &mssql.ServerRoleMemberArgs{
MemberId: pulumi.String("string"),
RoleId: pulumi.String("string"),
})
var serverRoleMemberResource = new ServerRoleMember("serverRoleMemberResource", ServerRoleMemberArgs.builder()
.memberId("string")
.roleId("string")
.build());
server_role_member_resource = mssql.ServerRoleMember("serverRoleMemberResource",
member_id="string",
role_id="string")
const serverRoleMemberResource = new mssql.ServerRoleMember("serverRoleMemberResource", {
memberId: "string",
roleId: "string",
});
type: mssql:ServerRoleMember
properties:
memberId: string
roleId: string
ServerRoleMember 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 ServerRoleMember resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the ServerRoleMember 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 ServerRoleMember Resource
Get an existing ServerRoleMember 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?: ServerRoleMemberState, opts?: CustomResourceOptions): ServerRoleMember
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
member_id: Optional[str] = None,
role_id: Optional[str] = None) -> ServerRoleMember
func GetServerRoleMember(ctx *Context, name string, id IDInput, state *ServerRoleMemberState, opts ...ResourceOption) (*ServerRoleMember, error)
public static ServerRoleMember Get(string name, Input<string> id, ServerRoleMemberState? state, CustomResourceOptions? opts = null)
public static ServerRoleMember get(String name, Output<String> id, ServerRoleMemberState 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.
Import
import using <role_id>/<member_id> - can be retrieved using sys.server_principals
view
$ pulumi import mssql:index/serverRoleMember:ServerRoleMember example '7/5'
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.