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

mssql.getSqlLogin

Explore with Pulumi AI

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

    Obtains information about single SQL login.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Mssql = Pulumi.Mssql;
    
    return await Deployment.RunAsync(() => 
    {
        var sa = Mssql.GetSqlLogin.Invoke(new()
        {
            Name = "sa",
        });
    
        return new Dictionary<string, object?>
        {
            ["id"] = sa.Apply(getSqlLoginResult => getSqlLoginResult.Id),
            ["dbId"] = sa.Apply(getSqlLoginResult => getSqlLoginResult.DefaultDatabaseId),
        };
    });
    
    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 {
    		sa, err := mssql.LookupSqlLogin(ctx, &mssql.LookupSqlLoginArgs{
    			Name: "sa",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("id", sa.Id)
    		ctx.Export("dbId", sa.DefaultDatabaseId)
    		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.GetSqlLoginArgs;
    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 sa = MssqlFunctions.getSqlLogin(GetSqlLoginArgs.builder()
                .name("sa")
                .build());
    
            ctx.export("id", sa.applyValue(getSqlLoginResult -> getSqlLoginResult.id()));
            ctx.export("dbId", sa.applyValue(getSqlLoginResult -> getSqlLoginResult.defaultDatabaseId()));
        }
    }
    
    import pulumi
    import pulumi_mssql as mssql
    
    sa = mssql.get_sql_login(name="sa")
    pulumi.export("id", sa.id)
    pulumi.export("dbId", sa.default_database_id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as mssql from "@pulumi/mssql";
    
    const sa = mssql.getSqlLogin({
        name: "sa",
    });
    export const id = sa.then(sa => sa.id);
    export const dbId = sa.then(sa => sa.defaultDatabaseId);
    
    variables:
      sa:
        fn::invoke:
          Function: mssql:getSqlLogin
          Arguments:
            name: sa
    outputs:
      id: ${sa.id}
      dbId: ${sa.defaultDatabaseId}
    

    Using getSqlLogin

    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 getSqlLogin(args: GetSqlLoginArgs, opts?: InvokeOptions): Promise<GetSqlLoginResult>
    function getSqlLoginOutput(args: GetSqlLoginOutputArgs, opts?: InvokeOptions): Output<GetSqlLoginResult>
    def get_sql_login(name: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetSqlLoginResult
    def get_sql_login_output(name: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetSqlLoginResult]
    func LookupSqlLogin(ctx *Context, args *LookupSqlLoginArgs, opts ...InvokeOption) (*LookupSqlLoginResult, error)
    func LookupSqlLoginOutput(ctx *Context, args *LookupSqlLoginOutputArgs, opts ...InvokeOption) LookupSqlLoginResultOutput

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

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

    The following arguments are supported:

    Name string
    Login name. Must follow Regular Identifiers rules and cannot contain \
    Name string
    Login name. Must follow Regular Identifiers rules and cannot contain \
    name String
    Login name. Must follow Regular Identifiers rules and cannot contain \
    name string
    Login name. Must follow Regular Identifiers rules and cannot contain \
    name str
    Login name. Must follow Regular Identifiers rules and cannot contain \
    name String
    Login name. Must follow Regular Identifiers rules and cannot contain \

    getSqlLogin Result

    The following output properties are available:

    CheckPasswordExpiration bool
    When true, password expiration policy is enforced for this login.
    CheckPasswordPolicy bool
    When true, the Windows password policies of the computer on which SQL Server is running are enforced on this login.
    DefaultDatabaseId string
    ID of login's default DB. The ID can be retrieved using mssql.Database data resource.
    DefaultLanguage string
    Default language assigned to login.
    Id string
    Login SID. Can be retrieved using SELECT SUSER_SID('<login_name>').
    MustChangePassword bool
    When true, password change will be forced on first logon.
    Name string
    Login name. Must follow Regular Identifiers rules and cannot contain \
    PrincipalId string
    ID used to reference SQL Login in other resources, e.g. server_role. Can be retrieved from sys.sql_logins.
    CheckPasswordExpiration bool
    When true, password expiration policy is enforced for this login.
    CheckPasswordPolicy bool
    When true, the Windows password policies of the computer on which SQL Server is running are enforced on this login.
    DefaultDatabaseId string
    ID of login's default DB. The ID can be retrieved using mssql.Database data resource.
    DefaultLanguage string
    Default language assigned to login.
    Id string
    Login SID. Can be retrieved using SELECT SUSER_SID('<login_name>').
    MustChangePassword bool
    When true, password change will be forced on first logon.
    Name string
    Login name. Must follow Regular Identifiers rules and cannot contain \
    PrincipalId string
    ID used to reference SQL Login in other resources, e.g. server_role. Can be retrieved from sys.sql_logins.
    checkPasswordExpiration Boolean
    When true, password expiration policy is enforced for this login.
    checkPasswordPolicy Boolean
    When true, the Windows password policies of the computer on which SQL Server is running are enforced on this login.
    defaultDatabaseId String
    ID of login's default DB. The ID can be retrieved using mssql.Database data resource.
    defaultLanguage String
    Default language assigned to login.
    id String
    Login SID. Can be retrieved using SELECT SUSER_SID('<login_name>').
    mustChangePassword Boolean
    When true, password change will be forced on first logon.
    name String
    Login name. Must follow Regular Identifiers rules and cannot contain \
    principalId String
    ID used to reference SQL Login in other resources, e.g. server_role. Can be retrieved from sys.sql_logins.
    checkPasswordExpiration boolean
    When true, password expiration policy is enforced for this login.
    checkPasswordPolicy boolean
    When true, the Windows password policies of the computer on which SQL Server is running are enforced on this login.
    defaultDatabaseId string
    ID of login's default DB. The ID can be retrieved using mssql.Database data resource.
    defaultLanguage string
    Default language assigned to login.
    id string
    Login SID. Can be retrieved using SELECT SUSER_SID('<login_name>').
    mustChangePassword boolean
    When true, password change will be forced on first logon.
    name string
    Login name. Must follow Regular Identifiers rules and cannot contain \
    principalId string
    ID used to reference SQL Login in other resources, e.g. server_role. Can be retrieved from sys.sql_logins.
    check_password_expiration bool
    When true, password expiration policy is enforced for this login.
    check_password_policy bool
    When true, the Windows password policies of the computer on which SQL Server is running are enforced on this login.
    default_database_id str
    ID of login's default DB. The ID can be retrieved using mssql.Database data resource.
    default_language str
    Default language assigned to login.
    id str
    Login SID. Can be retrieved using SELECT SUSER_SID('<login_name>').
    must_change_password bool
    When true, password change will be forced on first logon.
    name str
    Login name. Must follow Regular Identifiers rules and cannot contain \
    principal_id str
    ID used to reference SQL Login in other resources, e.g. server_role. Can be retrieved from sys.sql_logins.
    checkPasswordExpiration Boolean
    When true, password expiration policy is enforced for this login.
    checkPasswordPolicy Boolean
    When true, the Windows password policies of the computer on which SQL Server is running are enforced on this login.
    defaultDatabaseId String
    ID of login's default DB. The ID can be retrieved using mssql.Database data resource.
    defaultLanguage String
    Default language assigned to login.
    id String
    Login SID. Can be retrieved using SELECT SUSER_SID('<login_name>').
    mustChangePassword Boolean
    When true, password change will be forced on first logon.
    name String
    Login name. Must follow Regular Identifiers rules and cannot contain \
    principalId String
    ID used to reference SQL Login in other resources, e.g. server_role. Can be retrieved from sys.sql_logins.

    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