Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] New-DbaDbUser support for input via pipeline #6270

Closed
iampeterdaniels opened this issue Dec 27, 2019 · 2 comments · Fixed by #7411
Closed

[bug] New-DbaDbUser support for input via pipeline #6270

iampeterdaniels opened this issue Dec 27, 2019 · 2 comments · Fixed by #7411

Comments

@iampeterdaniels
Copy link
Contributor

Example #4 for New-DbaDbUser is incorrect. It states:
Get-DbaDbUser -SqlInstance sqlserver1 -Database DB1 | New-DbaDbUser -SqlInstance sqlserver2 -Database DB1

When I attempt to execute similar code, I get "The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input."

Which makes sense because none of the params for New-DbaDbUser accept pipeline input.
It would be nice if it did in fact accept pipeline input so we could copy one or more users from one DB to another. In the short term, removing the example from the docs would be sufficient.

https://github.com/sqlcollaborative/dbatools/blob/master/functions/New-DbaDbUser.ps1

@wsmelton wsmelton changed the title Docs for New-DbaDbUser example #4 incorrect. [bug] New-DbaDbUser support for input via pipeline Dec 28, 2019
@wsmelton
Copy link
Member

Command should accept piping from the following at a mininum:

  • Get-DbaDatabase
  • Get-DbaDbUser
  • Get-DbaLogin

@wsmelton wsmelton added the confirmed Label to be used by maintainers that confirm a bug does exist for the given issue label Dec 28, 2019
@andreasjordan
Copy link
Contributor

I disagree here. Allowing multiple object types piped in makes the commands complex and may introduce a lot of bugs.
A New-Dba* command should at maximum allow pipeline input from the object one level above in the SMO hierarchy, so New-DbaDbUser should only allow pipeline input from Get-DbaDatabase.

I will correct the documentation and remove the wrong example, then closing this issue.

If someone wants the functionality of the mentioned example, I see this as a feature request and the solution should be a Copy-DbaDbUser command.

We may want to add pipeline input support to this command, but I would see this as well as a (low priority) feature request.

@andreasjordan andreasjordan added solution provided and removed confirmed Label to be used by maintainers that confirm a bug does exist for the given issue labels Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants