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

mssql.getSqlUsers

Explore with Pulumi AI

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

    Obtains information about all SQL users found in a database

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Mssql = Pulumi.Mssql;
    
    return await Deployment.RunAsync(() => 
    {
        var master = Mssql.GetDatabase.Invoke(new()
        {
            Name = "master",
        });
    
        var example = Mssql.GetSqlUsers.Invoke(new()
        {
            DatabaseId = master.Apply(getDatabaseResult => getDatabaseResult.Id),
        });
    
        return new Dictionary<string, object?>
        {
            ["users"] = example.Apply(getSqlUsersResult => getSqlUsersResult.Users),
        };
    });
    
    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 {
    		master, err := mssql.LookupDatabase(ctx, &mssql.LookupDatabaseArgs{
    			Name: "master",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		example, err := mssql.GetSqlUsers(ctx, &mssql.GetSqlUsersArgs{
    			DatabaseId: pulumi.StringRef(master.Id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("users", example.Users)
    		return nil
    	})
    }
    
    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.GetDatabaseArgs;
    import com.pulumi.mssql.inputs.GetSqlUsersArgs;
    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 master = MssqlFunctions.getDatabase(GetDatabaseArgs.builder()
                .name("master")
                .build());
    
            final var example = MssqlFunctions.getSqlUsers(GetSqlUsersArgs.builder()
                .databaseId(master.applyValue(getDatabaseResult -> getDatabaseResult.id()))
                .build());
    
            ctx.export("users", example.applyValue(getSqlUsersResult -> getSqlUsersResult.users()));
        }
    }
    
    import pulumi
    import pulumi_mssql as mssql
    
    master = mssql.get_database(name="master")
    example = mssql.get_sql_users(database_id=master.id)
    pulumi.export("users", example.users)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as mssql from "@pulumi/mssql";
    
    const master = mssql.getDatabase({
        name: "master",
    });
    const example = master.then(master => mssql.getSqlUsers({
        databaseId: master.id,
    }));
    export const users = example.then(example => example.users);
    
    variables:
      master:
        fn::invoke:
          Function: mssql:getDatabase
          Arguments:
            name: master
      example:
        fn::invoke:
          Function: mssql:getSqlUsers
          Arguments:
            databaseId: ${master.id}
    outputs:
      users: ${example.users}
    

    Using getSqlUsers

    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 getSqlUsers(args: GetSqlUsersArgs, opts?: InvokeOptions): Promise<GetSqlUsersResult>
    function getSqlUsersOutput(args: GetSqlUsersOutputArgs, opts?: InvokeOptions): Output<GetSqlUsersResult>
    def get_sql_users(database_id: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetSqlUsersResult
    def get_sql_users_output(database_id: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetSqlUsersResult]
    func GetSqlUsers(ctx *Context, args *GetSqlUsersArgs, opts ...InvokeOption) (*GetSqlUsersResult, error)
    func GetSqlUsersOutput(ctx *Context, args *GetSqlUsersOutputArgs, opts ...InvokeOption) GetSqlUsersResultOutput

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

    public static class GetSqlUsers 
    {
        public static Task<GetSqlUsersResult> InvokeAsync(GetSqlUsersArgs args, InvokeOptions? opts = null)
        public static Output<GetSqlUsersResult> Invoke(GetSqlUsersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSqlUsersResult> getSqlUsers(GetSqlUsersArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: mssql:index/getSqlUsers:getSqlUsers
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DatabaseId string
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    DatabaseId string
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    databaseId String
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    databaseId string
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    database_id str
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    databaseId String
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').

    getSqlUsers Result

    The following output properties are available:

    Id string
    ID of the resource, equals to database ID
    Users List<Pulumiverse.Mssql.Outputs.GetSqlUsersUser>
    Set of SQL user objects
    DatabaseId string
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>'). Defaults to ID of master.
    Id string
    ID of the resource, equals to database ID
    Users []GetSqlUsersUser
    Set of SQL user objects
    DatabaseId string
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>'). Defaults to ID of master.
    id String
    ID of the resource, equals to database ID
    users List<GetSqlUsersUser>
    Set of SQL user objects
    databaseId String
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>'). Defaults to ID of master.
    id string
    ID of the resource, equals to database ID
    users GetSqlUsersUser[]
    Set of SQL user objects
    databaseId string
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>'). Defaults to ID of master.
    id str
    ID of the resource, equals to database ID
    users Sequence[GetSqlUsersUser]
    Set of SQL user objects
    database_id str
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>'). Defaults to ID of master.
    id String
    ID of the resource, equals to database ID
    users List<Property Map>
    Set of SQL user objects
    databaseId String
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>'). Defaults to ID of master.

    Supporting Types

    GetSqlUsersUser

    DatabaseId string
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    Id string
    <database_id>/<user_id>. User ID can be retrieved using SELECT DATABASE_PRINCIPAL_ID('<user_name>').
    LoginId string
    SID of SQL login. Can be retrieved using mssql.SqlLogin or SELECT SUSER_SID('<login_name>').
    Name string
    User name. Cannot be longer than 128 chars.
    DatabaseId string
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    Id string
    <database_id>/<user_id>. User ID can be retrieved using SELECT DATABASE_PRINCIPAL_ID('<user_name>').
    LoginId string
    SID of SQL login. Can be retrieved using mssql.SqlLogin or SELECT SUSER_SID('<login_name>').
    Name string
    User name. Cannot be longer than 128 chars.
    databaseId String
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    id String
    <database_id>/<user_id>. User ID can be retrieved using SELECT DATABASE_PRINCIPAL_ID('<user_name>').
    loginId String
    SID of SQL login. Can be retrieved using mssql.SqlLogin or SELECT SUSER_SID('<login_name>').
    name String
    User name. Cannot be longer than 128 chars.
    databaseId string
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    id string
    <database_id>/<user_id>. User ID can be retrieved using SELECT DATABASE_PRINCIPAL_ID('<user_name>').
    loginId string
    SID of SQL login. Can be retrieved using mssql.SqlLogin or SELECT SUSER_SID('<login_name>').
    name string
    User name. Cannot be longer than 128 chars.
    database_id str
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    id str
    <database_id>/<user_id>. User ID can be retrieved using SELECT DATABASE_PRINCIPAL_ID('<user_name>').
    login_id str
    SID of SQL login. Can be retrieved using mssql.SqlLogin or SELECT SUSER_SID('<login_name>').
    name str
    User name. Cannot be longer than 128 chars.
    databaseId String
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    id String
    <database_id>/<user_id>. User ID can be retrieved using SELECT DATABASE_PRINCIPAL_ID('<user_name>').
    loginId String
    SID of SQL login. Can be retrieved using mssql.SqlLogin or SELECT SUSER_SID('<login_name>').
    name String
    User name. Cannot be longer than 128 chars.

    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