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] Grant-DbaAgPermission doesn't perform GRANT #5889
Comments
Please note that once this issue is fixed, we'll no longer enter our |
Thanks for the report, @JanK-Orb ! Any chance you would be able to fix this issue? I will not have time until at least next week. |
This issue has been automatically marked as stale because it has not had recent activity. If you would like this issue to remain open:
|
This issue has been automatically closed because it has not had activity in the last three months. If this issue is still valid, please add a comment |
shakes fist at stale bot This is very much still a bug :( I'm happy to make the quick-fix. Would ya'll like/need additional tests around this? If so, I may not have the bandwidth to go that deep for a few weeks. @potatoqualitee - @'ing since stale bot doesn't seem like it wants to re-open after my comment. |
Environmental information
SQL Server:
Report
A bug:
line 114 : if ($perm -contains "CreateAnyDatabase") {
At this point $perm is undefined, parameter should be named $Permission
Could also consider changing the ALTER statement by wrapping the $ag parameter with [] to allow non-alphanumeric characters in AG names.
ALTER AVAILABILITY GROUP [$ag] GRANT CREATE ANY DATABASE
Host used
If anything other than powershell.exe was used, please confirm that you can duplicate the issue with powershell.exe
Errors Received
Actually, a lack of error is one way to observe the issue. (Though the command does not currently execute the Grant at all as it exits the if at line 114)
Steps to Reproduce
Execute Grant-DbaAgPermission with a -SqlInstance that doesn't exist.
Grant-DbaAgPermission -SqlInstance foo -Type AvailabilityGroup -AvailabilityGroup myAg -Permission CreateAnyDatabase
Also, executing the command with a real -SqlInstance doesn't actually execute the GRANT
Expected Behavior
When executing with a wrong -SqlInstance , an error message : "Error occurred while establishing connection to ..."
When executing with a correct -SqlInstance, a GRANT is executed.
Actual Behavior
GRANT isn't executed with a correct SqlInstance
No error when wrong SqlInstance is specified
The text was updated successfully, but these errors were encountered: