microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
379 stars 243 forks source link

Change request: remove users from sql backup #1526

Closed JanBoes closed 3 years ago

JanBoes commented 3 years ago

Script output:

BcContainerHelper version 1.0.15 BcContainerHelper is version 1.0.15 BcContainerHelper is running as administrator Host is Microsoft Windows 10 Pro - 20H2 Docker Client Version is 19.03.13 Docker Server Version is 19.03.13 Removing container -Test Removing C:\ProgramData\BcContainerHelper\Extensions*-Test Fetching all docker images Using image mcr.microsoft.com/businesscentral:10.0.19042.630 Creating Container *-Test Version: 16.7.18411.0-w1 Style: onprem Multitenant: No Platform: 16.0.18359.0 Generic Tag: 1.0.1.0 Container OS Version: 10.0.19042.630 (20H2) Host OS Version: 10.0.19042.630 (20H2) Using process isolation Using locale en-US Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable) Using license file c:\mprise\project\Licenties\BC*****.flf Additional Parameters: --volume "c:\mprise\project\-Test\Docker\Share:c:\project\dockershare" --env bakfile="c:\project\dockershare\bak\201208 *_BC16_SANDBOX.bak" Files in C:\ProgramData\BcContainerHelper\Extensions\-Test\my:


Change Request: As you can see I am trying to use a sql backup which contains too many users for my BC development license). Is it possible to remove all users before creating the ADMIN users? Any other way which results in a working docker environment is also fine

freddydk commented 3 years ago

The SetupNavUsers will check whether the user you specified as -credential already exists. If it does, it will not create the user. I see two options for you:

  1. To reuse a user who is already in the database
  2. to override SetupNavUsers.ps1 and use:
    Get-NAVServerUser $ServerInstance -Tenant default | % { Set-NAVServerUser -ServerInstance $ServerInstance -Tenant default -UserName $_.Username -State Disabled -ErrorAction SilentlyContinue }

    Before calling the default SetupNavUsers.ps1. This will disable all users (except for one SUPER user) You can also delete users in the override - it is not something I will do as default behavior, there are far too many side effects of that.