Add-RoleMember

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

语法

ParameterSetName (默认值)

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

ParameterSetInputObject

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

ParameterSetTabularInputObject

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

ParameterSetTabularName

Add-RoleMember
    [-Server <String>]
    [-Credential <PSCredential>]
    [-ServicePrincipal]
    [-ApplicationId <String>]
    [-TenantId <String>]
    [-CertificateThumbprint <String>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

说明

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

Module requirements: version 21+ on PowerShell 5.1; version 21 (recent preview) or version 22+ on PowerShell 7.x.

示例

Example 1: Add member to role using pipeline

PS SQLServer:\SQLAS\machine\instance\Databases\DB1\Roles\> $roles = Get-Children
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.

Example 2: Add member to role using pipeline in Tabular 1200

PS SQLServer:\SQLAS\machine\instance\Databases\DB1\Roles\> $roles = Get-Children
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.

Example 3: Add member to role using name

PS C:\> Add-RoleMember -MemberName "foo\user1" -Database "DB1" -RoleName "myRole"

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

参数

-ApplicationId

The application Id for the service principal.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-CertificateThumbprint

The certificate thumbprint for the service principal.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Confirm

Prompts you for confirmation before running the cmdlet.

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值: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.

参数属性

类型:PSCredential
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Database

Database name to which the Role belongs to.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ParameterSetName
Position:1
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DatabaseRole

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

参数属性

类型:Role
默认值:None
支持通配符:False
不显示:False

参数集

ParameterSetInputObject
Position:Named
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MemberName

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

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ParameterSetName
Position:0
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False
ParameterSetInputObject
Position:0
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False
ParameterSetTabularInputObject
Position:0
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ModelRole

The model role to add the member to.

参数属性

类型:ModelRole
默认值:None
支持通配符:False
不显示:False

参数集

ParameterSetTabularInputObject
Position:Named
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-RoleName

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

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ParameterSetName
Position:2
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Server

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

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ServicePrincipal

Specifies that this connection is using service principal.

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-TenantId

The tenant Id for the service principal.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WhatIf

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

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:wi

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

输入

Microsoft.AnalysisServices.Role

Microsoft.AnalysisServices.Tabular.ModelRole

输出

System.Object

None