Add-MgmtSvcDatabaseUser
Adds SQL authentication credentials for a user to the database.
Syntax
Add-MgmtSvcDatabaseUser
-User <String>
-UserPassword <String>
[-RoleName <String>]
[-Force]
-Schema <String>
[-ConnectionString <String>]
[-Server <String>]
[-Database <String>]
[-UserName <String>]
[-Password <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Add-MgmtSvcDatabaseUser cmdlet adds SQL authentication credentials for a specified user in the database. Specify the user name and password. You can also specify a user role for the account. Note that the Initialize-MgmtSvcFeature cmdlet adds the necessary users to Windows Azure Pack for Windows Server. You only need to use Add-MgmtSvcDatabaseUser to add additional users.
You can run this cmdlet from any computer in the deployment. However, this cmdlet assumes that the database is on the local computer. If the database is on another computer, you must use the Server, UserName, Password, and Database parameters, or a SQL connection string. If you specify a connection string by using the ConnectionString parameter, that value takes precedence over the Server, UserName, Password, and Database parameters.
Examples
Example 1: Add a user to a database for a schema
PS C:\> Add-MgmtSvcDatabaseUser -Schema "SqlServer" -User "user" -UserPassword "Sand3289" -RoleName "DBO" -Database "Contoso.MgmtSvc.Store" -Server "ContosoSQLServer"
This command adds the user named user to the database named Contoso.MgmtSvc.Store for the schema SqlServer. The command specifies the computer that runs SQL Server. The command also specifies a password and the role DBO for the new user.
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ConnectionString
Specifies an SQL connection string.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Database
Specifies a database name.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Force
{{Fill Force Description}}
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Password
Specifies a password.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RoleName
Specifies the name of a role for the added account. Roles are used to grant or deny user access to database objects. Roles and database access are specific to a schema.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Schema
Specifies a schema.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Server
Specifies the name of the computer on which the SQL database resides.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-User
Specifies the user name of the principal. The cmdlet adds this account to the database for the specified schema.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-UserName
Specifies the name of a user account.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-UserPassword
Specifies a password for the principal account specified by the User parameter. The cmdlet adds this account to the database for the specified schema.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
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: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |