Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

Convert-PermissionSets

Posted on by 10

Convert-PermissionSets -DatabaseServer TESTINGSERVER -DatabaseName "Demo Database BC (21-0)" -Destination "C:\Users\Documents\Downloads\PermissionSetConversion\Convert-PermissionSets"

after putting above command I'm getting this error Please help me to resolve this.

Downloading Symbols from TESTINGSERVER Demo Database BC (21-0)
Invoke-Sqlcmd : Cannot open database "Demo Database BC (21-0)" requested by the login. The login failed.
Login failed for user 'ANANTSO\fs0539'.
At C:\Users\fs0539\Documents\Downloads\PermissionSetConversion\Convert-PermissionSets.psm1:499 char:13
+ $Apps = Invoke-Sqlcmd -ServerInstance $DatabaseServer -Database $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlException
+ FullyQualifiedErrorId : SqlExectionError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand

Invoke-Sqlcmd :
At C:\Users\fs0539\Documents\Downloads\PermissionSetConversion\Convert-PermissionSets.psm1:499 char:13
+ $Apps = Invoke-Sqlcmd -ServerInstance $DatabaseServer -Database $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (:) [Invoke-Sqlcmd], ParserException
+ FullyQualifiedErrorId : ExecutionFailureException,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand

You cannot call a method on a null-valued expression.
At C:\Users\fs0539\Documents\Downloads\PermissionSetConversion\Convert-PermissionSets.psm1:502 char:17
+ ... $Apps | % { $_.Name = $_.Name.Replace('_Exclude_', '').TrimEnd('_')}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

Proccessing Symbols
Quering permissions from TESTINGSERVER Demo Database BC (21-0)
Invoke-Sqlcmd : Cannot open database "Demo Database BC (21-0)" requested by the login. The login failed.
Login failed for user 'ANANTSOL\fs0539'.
At C:\Users\fs0539\Documents\Downloads\PermissionSetConversion\Convert-PermissionSets.psm1:518 char:20
+ ... rmissions = Invoke-Sqlcmd -ServerInstance $DatabaseServer -Database $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlException
+ FullyQualifiedErrorId : SqlExectionError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand

Invoke-Sqlcmd :
At C:\Users\fs0539\Documents\Downloads\PermissionSetConversion\Convert-PermissionSets.psm1:518 char:20
+ ... rmissions = Invoke-Sqlcmd -ServerInstance $DatabaseServer -Database $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (:) [Invoke-Sqlcmd], ParserException
+ FullyQualifiedErrorId : ExecutionFailureException,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand
Convert-PermissionSets -DatabaseServer TESTINGSERVER -DatabaseName "Demo Database BC (21-0)" -Destination "C:\Users\Documents\Downloads\PermissionSetConversion"

After putting above command I'm getting below error please help me to resove this error.

Invoke-Sqlcmd : Cannot open database "Demo Database BC (21-0)" requested by the login. The login failed.
Login failed for user 'ANANTSOL\fs0539'.
At C:\Users\fs0539\Documents\Downloads\PermissionSetConversion\Convert-PermissionSets.psm1:558 char:34
+ ... leContent = Invoke-Sqlcmd -ServerInstance $DatabaseServer -Database $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlException
+ FullyQualifiedErrorId : SqlExectionError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand

Invoke-Sqlcmd :
At C:\Users\fs0539\Documents\Downloads\PermissionSetConversion\Convert-PermissionSets.psm1:558 char:34
+ ... leContent = Invoke-Sqlcmd -ServerInstance $DatabaseServer -Database $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (:) [Invoke-Sqlcmd], ParserException
+ FullyQualifiedErrorId : ExecutionFailureException,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand

WritePermissionSets : Cannot validate argument on parameter 'PermissionSets'. The argument is null, empty, or an element of the argument
collection contains a null value. Supply a collection that does not contain any null values and then try the command again.
At C:\Users\fs0539\Documents\Downloads\PermissionSetConversion\Convert-PermissionSets.psm1:559 char:25
+ WritePermissionSets $PermissionSets $Destination $PermissionSetTa ...
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [WritePermissionSets], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,WritePermissionSets

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,296 Super User 2024 Season 2 on at
    RE: Convert-PermissionSets

    Hi, I agree with Franz, from the information below, your user does not have permission to log into this database.

    Invoke-Sqlcmd : Cannot open database "Demo Database BC (21-0)" requested by the login. The login failed.
    Login failed for user 'ANANTSOL\fs0539'.

    More about Convert permission sets into AL object: https://yzhums.com/12194/

    And, from BC21, you can use new command to generate or update AL permission set directly.
    More details: 
    https://yzhums.com/29221/

    Hope this helps as well.

    Thanks.

    ZHU

  • Suggested answer
    keoma Profile Picture
    keoma 32,675 on at
    RE: Convert-PermissionSets

    check if user 'ANANTSO\fs0539' has access to db "Demo Database BC (21-0)".

    also follow www.sqlservercentral.com/.../invoke-sqlcmd-cannot-open-database-requested-by-the-login-login-login-failed

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,188 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans