Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse
mssql.getSqlUsers
Explore with Pulumi AI
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:
- Database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
.
- Database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
.
- database
Id String - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
.
- database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
.
- database_
id str - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
.
- database
Id String - ID of database. Can be retrieved using
mssql.Database
orSELECT 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. Get Sql Users User> - Set of SQL user objects
- Database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
.
- Id string
- ID of the resource, equals to database ID
- Users
[]Get
Sql Users User - Set of SQL user objects
- Database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
.
- id String
- ID of the resource, equals to database ID
- users
List<Get
Sql Users User> - Set of SQL user objects
- database
Id String - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
.
- id string
- ID of the resource, equals to database ID
- users
Get
Sql Users User[] - Set of SQL user objects
- database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
.
- id str
- ID of the resource, equals to database ID
- users
Sequence[Get
Sql Users User] - Set of SQL user objects
- database_
id str - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
.
- id String
- ID of the resource, equals to database ID
- users List<Property Map>
- Set of SQL user objects
- database
Id String - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
.
Supporting Types
GetSqlUsersUser
- Database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. - Id string
<database_id>/<user_id>
. User ID can be retrieved usingSELECT DATABASE_PRINCIPAL_ID('<user_name>')
.- Login
Id string - SID of SQL login. Can be retrieved using
mssql.SqlLogin
orSELECT SUSER_SID('<login_name>')
. - Name string
- User name. Cannot be longer than 128 chars.
- Database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. - Id string
<database_id>/<user_id>
. User ID can be retrieved usingSELECT DATABASE_PRINCIPAL_ID('<user_name>')
.- Login
Id string - SID of SQL login. Can be retrieved using
mssql.SqlLogin
orSELECT SUSER_SID('<login_name>')
. - Name string
- User name. Cannot be longer than 128 chars.
- database
Id String - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. - id String
<database_id>/<user_id>
. User ID can be retrieved usingSELECT DATABASE_PRINCIPAL_ID('<user_name>')
.- login
Id String - SID of SQL login. Can be retrieved using
mssql.SqlLogin
orSELECT SUSER_SID('<login_name>')
. - name String
- User name. Cannot be longer than 128 chars.
- database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. - id string
<database_id>/<user_id>
. User ID can be retrieved usingSELECT DATABASE_PRINCIPAL_ID('<user_name>')
.- login
Id string - SID of SQL login. Can be retrieved using
mssql.SqlLogin
orSELECT 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
orSELECT DB_ID('<db_name>')
. - id str
<database_id>/<user_id>
. User ID can be retrieved usingSELECT DATABASE_PRINCIPAL_ID('<user_name>')
.- login_
id str - SID of SQL login. Can be retrieved using
mssql.SqlLogin
orSELECT SUSER_SID('<login_name>')
. - name str
- User name. Cannot be longer than 128 chars.
- database
Id String - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. - id String
<database_id>/<user_id>
. User ID can be retrieved usingSELECT DATABASE_PRINCIPAL_ID('<user_name>')
.- login
Id String - SID of SQL login. Can be retrieved using
mssql.SqlLogin
orSELECT 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.
Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse