1. Packages
  2. MSSQL
  3. API Docs
  4. getAzureadUser
Microsoft SQL Server v0.1.0 published on Tuesday, Oct 8, 2024 by pulumiverse

mssql.getAzureadUser

Explore with Pulumi AI

mssql logo
Microsoft SQL Server v0.1.0 published on Tuesday, Oct 8, 2024 by pulumiverse

    Obtains information about single Azure AD database user.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as mssql from "@pulumi/mssql";
    
    const exampleDatabase = mssql.getDatabase({
        name: "example",
    });
    const exampleAzureadUser = exampleDatabase.then(exampleDatabase => mssql.getAzureadUser({
        name: "example",
        databaseId: exampleDatabase.id,
    }));
    export const userObjectId = exampleAzureadUser.then(exampleAzureadUser => exampleAzureadUser.userObjectId);
    
    import pulumi
    import pulumi_mssql as mssql
    
    example_database = mssql.get_database(name="example")
    example_azuread_user = mssql.get_azuread_user(name="example",
        database_id=example_database.id)
    pulumi.export("userObjectId", example_azuread_user.user_object_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 {
    		exampleDatabase, err := mssql.LookupDatabase(ctx, &mssql.LookupDatabaseArgs{
    			Name: "example",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleAzureadUser, err := mssql.LookupAzureadUser(ctx, &mssql.LookupAzureadUserArgs{
    			Name:       pulumi.StringRef("example"),
    			DatabaseId: exampleDatabase.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("userObjectId", exampleAzureadUser.UserObjectId)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Mssql = Pulumi.Mssql;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleDatabase = Mssql.GetDatabase.Invoke(new()
        {
            Name = "example",
        });
    
        var exampleAzureadUser = Mssql.GetAzureadUser.Invoke(new()
        {
            Name = "example",
            DatabaseId = exampleDatabase.Apply(getDatabaseResult => getDatabaseResult.Id),
        });
    
        return new Dictionary<string, object?>
        {
            ["userObjectId"] = exampleAzureadUser.Apply(getAzureadUserResult => getAzureadUserResult.UserObjectId),
        };
    });
    
    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.GetAzureadUserArgs;
    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 exampleDatabase = MssqlFunctions.getDatabase(GetDatabaseArgs.builder()
                .name("example")
                .build());
    
            final var exampleAzureadUser = MssqlFunctions.getAzureadUser(GetAzureadUserArgs.builder()
                .name("example")
                .databaseId(exampleDatabase.applyValue(getDatabaseResult -> getDatabaseResult.id()))
                .build());
    
            ctx.export("userObjectId", exampleAzureadUser.applyValue(getAzureadUserResult -> getAzureadUserResult.userObjectId()));
        }
    }
    
    variables:
      exampleDatabase:
        fn::invoke:
          Function: mssql:getDatabase
          Arguments:
            name: example
      exampleAzureadUser:
        fn::invoke:
          Function: mssql:getAzureadUser
          Arguments:
            name: example
            databaseId: ${exampleDatabase.id}
    outputs:
      userObjectId: ${exampleAzureadUser.userObjectId}
    

    Using getAzureadUser

    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 getAzureadUser(args: GetAzureadUserArgs, opts?: InvokeOptions): Promise<GetAzureadUserResult>
    function getAzureadUserOutput(args: GetAzureadUserOutputArgs, opts?: InvokeOptions): Output<GetAzureadUserResult>
    def get_azuread_user(database_id: Optional[str] = None,
                         name: Optional[str] = None,
                         user_object_id: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetAzureadUserResult
    def get_azuread_user_output(database_id: Optional[pulumi.Input[str]] = None,
                         name: Optional[pulumi.Input[str]] = None,
                         user_object_id: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetAzureadUserResult]
    func LookupAzureadUser(ctx *Context, args *LookupAzureadUserArgs, opts ...InvokeOption) (*LookupAzureadUserResult, error)
    func LookupAzureadUserOutput(ctx *Context, args *LookupAzureadUserOutputArgs, opts ...InvokeOption) LookupAzureadUserResultOutput

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

    public static class GetAzureadUser 
    {
        public static Task<GetAzureadUserResult> InvokeAsync(GetAzureadUserArgs args, InvokeOptions? opts = null)
        public static Output<GetAzureadUserResult> Invoke(GetAzureadUserInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAzureadUserResult> getAzureadUser(GetAzureadUserArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: mssql:index/getAzureadUser:getAzureadUser
      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>').
    Name string
    User name. Cannot be longer than 128 chars.
    UserObjectId string
    Azure AD object_id of the user. This can be either regular user or a group.
    DatabaseId string
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    Name string
    User name. Cannot be longer than 128 chars.
    UserObjectId string
    Azure AD object_id of the user. This can be either regular user or a group.
    databaseId String
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    name String
    User name. Cannot be longer than 128 chars.
    userObjectId String
    Azure AD object_id of the user. This can be either regular user or a group.
    databaseId string
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    name string
    User name. Cannot be longer than 128 chars.
    userObjectId string
    Azure AD object_id of the user. This can be either regular user or a group.
    database_id str
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    name str
    User name. Cannot be longer than 128 chars.
    user_object_id str
    Azure AD object_id of the user. This can be either regular user or a group.
    databaseId String
    ID of database. Can be retrieved using mssql.Database or SELECT DB_ID('<db_name>').
    name String
    User name. Cannot be longer than 128 chars.
    userObjectId String
    Azure AD object_id of the user. This can be either regular user or a group.

    getAzureadUser Result

    The following output properties are available:

    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 sys.database_principals view.
    Name string
    User name. Cannot be longer than 128 chars.
    UserObjectId string
    Azure AD object_id of the user. This can be either regular user or a group.
    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 sys.database_principals view.
    Name string
    User name. Cannot be longer than 128 chars.
    UserObjectId string
    Azure AD object_id of the user. This can be either regular user or a group.
    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 sys.database_principals view.
    name String
    User name. Cannot be longer than 128 chars.
    userObjectId String
    Azure AD object_id of the user. This can be either regular user or a group.
    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 sys.database_principals view.
    name string
    User name. Cannot be longer than 128 chars.
    userObjectId string
    Azure AD object_id of the user. This can be either regular user or a group.
    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 sys.database_principals view.
    name str
    User name. Cannot be longer than 128 chars.
    user_object_id str
    Azure AD object_id of the user. This can be either regular user or a group.
    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 sys.database_principals view.
    name String
    User name. Cannot be longer than 128 chars.
    userObjectId String
    Azure AD object_id of the user. This can be either regular user or a group.

    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.1.0 published on Tuesday, Oct 8, 2024 by pulumiverse