Add-RoleMember

Adds a member to a specific Role of a specific database.

Syntax

Add-RoleMember
   -MemberName <String>
   [-Database] <String>
   [-RoleName] <String>
   [-Server <String>]
   [-Credential <PSCredential>]
   [-ServicePrincipal]
   [-ApplicationId <String>]
   [-TenantId <String>]
   [-CertificateThumbprint <String>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-RoleMember
   -MemberName <String>
   -DatabaseRole <Role>
   [-Server <String>]
   [-Credential <PSCredential>]
   [-ServicePrincipal]
   [-ApplicationId <String>]
   [-TenantId <String>]
   [-CertificateThumbprint <String>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-RoleMember
   -MemberName <String>
   -ModelRole <ModelRole>
   [-Server <String>]
   [-Credential <PSCredential>]
   [-ServicePrincipal]
   [-ApplicationId <String>]
   [-TenantId <String>]
   [-CertificateThumbprint <String>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-RoleMember
   [-Server <String>]
   [-Credential <PSCredential>]
   [-ServicePrincipal]
   [-ApplicationId <String>]
   [-TenantId <String>]
   [-CertificateThumbprint <String>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Add-RoleMember cmdlet adds a valid member to a specific Role of a specific database depending upon the input values.

Examples

Add member to role using pipeline

PS SQLServer:\SQLAS\machine\instance\Databases\DB1\Roles\> $roles = dir
PS SQLServer:\SQLAS\machine\instance\Databases\DB1\Roles\> $roles[0] | Add-RoleMember -MemberName "memberName"

This command adds a member to the first role of a given database.

Add member to role using pipeline in Tabular 1200

PS SQLServer:\SQLAS\machine\instance\Databases\DB1\Roles\> $roles=dir
PS SQLServer:\SQLAS\machine\instance\Databases\DB1\Roles\> Add-RoleMember -MemberName "memberName" -ModelRole $roles[0]

Add a member to the first role of a given database using named parameters for a tabular database with compatibility level 1200 or higher.

Add member to role using name

Add-RoleMember -MemberName "foo\user1" -Database "DB1" -RoleName "myRole"

Add a member to the database role using the role's name

Parameters

-ApplicationId

The application Id for the service principal.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-CertificateThumbprint

The certificate thumbprint for the service principal.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Credential

If this parameter is specified, the user name and password passed will be used to connect to specified Analysis Server instance. If no credentials are specified default windows account of the user who is running the tool will be used.

Type:PSCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Database

Database name to which the Role belongs to.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DatabaseRole

The Microsoft.AnalysisServices.Role to add a member to. This not applicable to tabular databases with compatibility level 1200 or higher.

Type:Role
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-MemberName

Name of the member who should be added to the role.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ModelRole

{{Fill ModelRole Description}}

Type:ModelRole
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-RoleName

Name of the Role to which the member should be added.

Type:String
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Server

Optionally specifies the server instance to connect to if not currently in the SQLAS Provider directory.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ServicePrincipal

Specifies that this connection is using service principal.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TenantId

The tenant Id for the service principal.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.AnalysisServices.Role

Microsoft.AnalysisServices.Tabular.ModelRole

Outputs

System.Object

None

Notes

Supported on all Analysis Services instances