microsoft / navcontainerhelper

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

Unnecessary administrator check when creating container that uses external database server #3055

Closed ernestasjuska closed 1 year ago

ernestasjuska commented 1 year ago

Hi,

There is an unnecessary administrator check when creating container that uses an external database server. Commenting configuration lines related to database server removes the run as administrator check error. What is weird is that error message is about NAVWebClientManagement.psm1 which should be unrelated.

In our company we are required to have two separate Windows accounts: a domain account without admin permissions and a local admin account. I already ran Check-BcContainerHelperPermissions -Fix while in domain account.

My guess is that somehow the NAVWebClientManagement.psm1 module is imported not by PowerShell session inside the container but by my domain user that does not have admin permissions so I get the error.

Thanks.

Script used to create the container - uncomment lines in $Database to reproduce error:

Import-Module -Name BcContainerHelper -DisableNameChecking

$ContainerName = 'bcserver'
# You can change this. Get-BCArtifactUrl -type OnPrem -country w1  gives the same error.
$BcArtifactUrl = Get-BCArtifactUrl -type Sandbox -country lt -version 21.5.53619; $BcArtifactUrl
$Credential = New-Object -TypeName pscredential -ArgumentList 'user', ('Password1.' | ConvertTo-SecureString -AsPlainText -Force)
$DatabaseCredential = New-Object -TypeName pscredential -ArgumentList 'sa', ('Password1.' | ConvertTo-SecureString -AsPlainText -Force)
$LicenseFile = 'C:\Users\ernjus\OneDrive - Softera Baltic UAB\Desktop\BC21.bclicense'

$Container = @{
    accept_eula = $true
    containerName = $ContainerName
    isolation = 'hyperv'
    updateHosts = $true
    artifactUrl = $BcArtifactUrl
    auth = 'NavUserPassword'
    Credential = $Credential
    enableTaskScheduler = $true
    licenseFile = $LicenseFile
}
$Database = @{
    multitenant = $true
    <#
    databaseServer = 'host.containerhelper.internal'
    databaseInstance = 'SQL2022DEV'
    databasePrefix = "${ContainerName}-"
    databaseName = 'app'
    databaseCredential = $DatabaseCredential
    replaceExternalDatabases = $true
    #>
}
New-BcContainer @Container @Database

Running with external database:

https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
BcContainerHelper is version 5.0.2
BcContainerHelper is not running as administrator
UsePsSession is False
Host is Microsoft Windows 11 Enterprise - 10.0.22621.1702
Docker Client Version is 24.0.0
Docker Server Version is 24.0.0
Removing Session bcserver
Removing container bcserver
Removing entries from hosts
Removing bcserver from container hosts file
Removing bcserver-* from container hosts file
Removing Desktop shortcuts
Removing C:\ProgramData\BcContainerHelper\Extensions\bcserver
Starting Database Restore job from https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\5.0.2\Import-BcContainerHelper.ps1
Fetching all docker images
Fetching all docker volumes
Using image mcr.microsoft.com/businesscentral:10.0.20348.1726
Creating Container bcserver
Style: sandbox
Multitenant: Yes
Version: 21.5.53619.56709
Platform: 21.0.53597.56691
Generic Tag: 1.0.2.14
Container OS Version: 10.0.20348.1726 (ltsc2022)
Host OS Version: 10.0.22621.1702 (22H2)
Using hyperv isolation
Using locale 
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file C:\Users\ernjus\OneDrive - Softera Baltic UAB\Desktop\BC21.bclicense
Additional Parameters:
--env customNavSettings=EnableTaskScheduler=True
Files in C:\ProgramData\BcContainerHelper\Extensions\bcserver\my:
- AdditionalOutput.ps1
- license.bclicense
- MainLoop.ps1
- SetupDatabase.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container bcserver from image mcr.microsoft.com/businesscentral:10.0.20348.1726
e4d0e05e7880eefa912f449db7c843c25899c50eb139b9b0d21847a5d7a40bb4
Waiting for container bcserver to be ready
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
Using installer from C:\Run\210-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\Program Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\WebSearch
Copying Web Client Files
c:\dl\sandbox\21.5.53619.56709\platform\WebClient\Microsoft Dynamics NAV
Copying ModernDev Files
c:\dl\sandbox\21.5.53619.56709\platform
c:\dl\sandbox\21.5.53619.56709\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\21.5.53619.56709\platform\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\21.5.53619.56709\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\21.5.53619.56709\lt\Extensions
Copying Applications
C:\dl\sandbox\21.5.53619.56709\platform\Applications
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Skipping restore of Cronus database
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Installation took 15 seconds
Installation complete
Initializing...
Setting host.docker.internal to 192.168.0.53 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 192.168.0.53 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.27.144.1 in container hosts file
Starting Container
Hostname is bcserver
PublicDnsName is bcserver
Using NavUserPassword Authentication
Error restoring databases. Error was The script 'NAVWebClientManagement.psm1' cannot be run because it contains a "#requires" statement for running as A
dministrator. The current Windows PowerShell session is not running as Administrator. Start Windows PowerShell by  using the Run as Administrator option
, and then try running the script again.
at <ScriptBlock>, C:\bcartifacts.cache\sandbox\21.5.53619.56709\platform\ServiceTier\program files\Microsoft Dynamics NAV\210\Service\Microsoft.Dynamics
.Nav.Management.psm1: line 1
at <ScriptBlock>, <No file>: line 28Error
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
Using installer from C:\Run\210-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\Program Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\WebSearch
Copying Web Client Files
c:\dl\sandbox\21.5.53619.56709\platform\WebClient\Microsoft Dynamics NAV
Copying ModernDev Files
c:\dl\sandbox\21.5.53619.56709\platform
c:\dl\sandbox\21.5.53619.56709\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\21.5.53619.56709\platform\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\21.5.53619.56709\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\21.5.53619.56709\lt\Extensions
Copying Applications
C:\dl\sandbox\21.5.53619.56709\platform\Applications
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Skipping restore of Cronus database
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Installation took 15 seconds
Installation complete
Initializing...
Setting host.docker.internal to 192.168.0.53 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 192.168.0.53 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.27.144.1 in container hosts file
Starting Container
Hostname is bcserver
PublicDnsName is bcserver
Using NavUserPassword Authentication
Error restoring databases. Error was The script 'NAVWebClientManagement.psm1' cannot be run because it contains a "#requires" statement for running as A
dministrator. The current Windows PowerShell session is not running as Administrator. Start Windows PowerShell by  using the Run as Administrator option
, and then try running the script again.
at <ScriptBlock>, C:\bcartifacts.cache\sandbox\21.5.53619.56709\platform\ServiceTier\program files\Microsoft Dynamics NAV\210\Service\Microsoft.Dynamics
.Nav.Management.psm1: line 1
at <ScriptBlock>, <No file>: line 28
New-BcContainer Telemetry Correlation Id: 65f270b7-d972-4d9d-b2ee-1f8e0a9b8948
Initialization of container bcserver failed
At C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\5.0.2\ContainerHandling\Wait-NavContainerReady.ps1:42 char:17
+ ...             throw "Initialization of container $containerName failed" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Initialization ...bcserver failed:String) [], RuntimeException
    + FullyQualifiedErrorId : Initialization of container bcserver failed

Running with container database:

https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
BcContainerHelper is version 5.0.2
BcContainerHelper is not running as administrator
UsePsSession is False
Host is Microsoft Windows 11 Enterprise - 10.0.22621.1702
Docker Client Version is 24.0.0
Docker Server Version is 24.0.0
Removing Session bcserver
Removing container bcserver
Removing entries from hosts
Removing bcserver from container hosts file
Removing bcserver-* from container hosts file
Removing Desktop shortcuts
Removing C:\ProgramData\BcContainerHelper\Extensions\bcserver
Fetching all docker images
Fetching all docker volumes
Using image mcr.microsoft.com/businesscentral:10.0.20348.1726
Creating Container bcserver
Style: sandbox
Multitenant: Yes
Version: 21.5.53619.56709
Platform: 21.0.53597.56691
Generic Tag: 1.0.2.14
Container OS Version: 10.0.20348.1726 (ltsc2022)
Host OS Version: 10.0.22621.1702 (22H2)
Using hyperv isolation
Using locale 
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file C:\Users\ernjus\OneDrive - Softera Baltic UAB\Desktop\BC21.bclicense
Additional Parameters:
--env customNavSettings=EnableTaskScheduler=True
Files in C:\ProgramData\BcContainerHelper\Extensions\bcserver\my:
- AdditionalOutput.ps1
- license.bclicense
- MainLoop.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container bcserver from image mcr.microsoft.com/businesscentral:10.0.20348.1726
88893b25af0848724516034911cffe6fd0d9fe5eb03986441f34d203a9820d77
Waiting for container bcserver to be ready
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
Using installer from C:\Run\210-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\Program Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\WebSearch
Copying Web Client Files
c:\dl\sandbox\21.5.53619.56709\platform\WebClient\Microsoft Dynamics NAV
Copying ModernDev Files
c:\dl\sandbox\21.5.53619.56709\platform
c:\dl\sandbox\21.5.53619.56709\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\21.5.53619.56709\platform\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\21.5.53619.56709\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\21.5.53619.56709\lt\Extensions
Copying Applications
C:\dl\sandbox\21.5.53619.56709\platform\Applications
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Restoring CRONUS Demo Database
Setting CompatibilityLevel for tenant on localhost\SQLEXPRESS
Exporting Application to CRONUS
Removing Application from tenant
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Starting Business Central Service Tier
Importing license file
Copying Database on localhost\SQLEXPRESS from tenant to default
Taking database tenant offline
Copying database files
Attaching files as new Database default
Putting database tenant back online
Mounting tenant database
Mounting Database for default on server localhost\SQLEXPRESS with AllowAppDatabaseWrite = False
Sync'ing Tenant
Tenant is Operational
Stopping Business Central Service Tier
Installation took 85 seconds
Installation complete
Initializing...
Setting host.docker.internal to 192.168.0.53 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 192.168.0.53 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.27.144.1 in container hosts file
Starting Container
Hostname is bcserver
PublicDnsName is bcserver
Using NavUserPassword Authentication
Creating Self Signed Certificate
Self Signed Certificate Thumbprint 46DB8D86E9533F23DF59634B762C646D743520E8
DNS identity bcserver
Modifying Service Tier Config File with Instance Specific Settings
Modifying Service Tier Config File with settings from environment variable
Setting EnableTaskScheduler to True
Starting Service Tier
Registering event sources
Creating DotNetCore Web Server Instance
Using application pool name: BC
Using default container name: NavWebApplicationContainer
Copy files to WWW root C:\inetpub\wwwroot\BC
Create the application pool BC
Create website: NavWebApplicationContainer without SSL
Update configuration: navsettings.json
Done Configuring Web Client
Enabling Financials User Experience
Using license file 'c:\run\my\license.bclicense'
Import License
Dismounting Tenant
Mounting Tenant
Mounting Database for default on server localhost\SQLEXPRESS with AllowAppDatabaseWrite = False
Sync'ing Tenant
Tenant is Operational
Creating http download site
Setting SA Password and enabling SA
Creating user as SQL User and add to sysadmin
Creating SUPER user
Container IP Address: 172.27.157.40
Container Hostname  : bcserver
Container Dns Name  : bcserver
Web Client          : http://bcserver/BC/?tenant=default
Dev. Server         : http://bcserver
Dev. ServerInstance : BC
Dev. Server Tenant  : default
Setting bcserver to 172.27.157.40 in host hosts file
Setting bcserver-default to 172.27.157.40 in host hosts file
Setting bcserver-default to 172.27.157.40 in container hosts file

Files:
http://bcserver:8080/ALLanguage.vsix

Container Total Physical Memory is 8.5Gb
Container Free Physical Memory is 4.9Gb

Initialization took 25 seconds
Ready for connections!
Reading CustomSettings.config from bcserver
Creating Desktop Shortcuts for bcserver
Container bcserver successfully created

Use:
Get-BcContainerEventLog -containerName bcserver to retrieve a snapshot of the event log from the container
Get-BcContainerDebugInfo -containerName bcserver to get debug information about the container
Enter-BcContainer -containerName bcserver to open a PowerShell prompt inside the container
Remove-BcContainer -containerName bcserver to remove the container again
docker logs bcserver to retrieve information about URL's again
freddydk commented 1 year ago

Does this happen every time? The only place, where this module is loaded is inside SetupWebClient.ps1 - in the container. It is never actually loaded on the host...

ernestasjuska commented 1 year ago

I could also reproduce it when running as domain user just not running as administator on a different computer.

PS C:\Users\ernjus> Import-Module -Name BcContainerHelper -DisableNameChecking

$ContainerName = 'bcserver'
# You can change this. Get-BCArtifactUrl -type OnPrem -country w1  gives the same error.
$BcArtifactUrl = Get-BCArtifactUrl -type Sandbox -country lt -version 21.5.53619; $BcArtifactUrl
$Credential = New-Object -TypeName pscredential -ArgumentList 'user', ('Password1.' | ConvertTo-SecureString -AsPlainText -Force)
$DatabaseCredential = New-Object -TypeName pscredential -ArgumentList 'sa', ('Password1.' | ConvertTo-SecureString -AsPlainText -Force)
$LicenseFile = 'C:\Users\ernjus\OneDrive - Softera Baltic UAB\Desktop\BC21.bclicense'

$Container = @{
    accept_eula = $true
    containerName = $ContainerName
    isolation = 'hyperv'
    updateHosts = $true
    artifactUrl = $BcArtifactUrl
    auth = 'NavUserPassword'
    Credential = $Credential
    enableTaskScheduler = $true
    #licenseFile = $LicenseFile
}
$Database = @{
    multitenant = $true
    databaseServer = 'host.containerhelper.internal'
    databaseInstance = 'SQL2019DEV'
    databasePrefix = "${ContainerName}-"
    databaseName = 'app'
    databaseCredential = $DatabaseCredential
    replaceExternalDatabases = $true
}
New-BcContainer @Container @Database
https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
BcContainerHelper is version 5.0.2
BcContainerHelper is not running as administrator
UsePsSession is False
Host is Microsoft Windows Server 2019 Standard - 10.0.17763.3887
Docker Client Version is 19.03.5
Docker Server Version is 19.03.5
Removing Desktop shortcuts
Starting Database Restore job from https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\5.0.2\Import-BcContainerHelper.ps1
Fetching all docker images
Fetching all docker volumes
Using image mcr.microsoft.com/businesscentral:10.0.17763.3887
Creating Container bcserver
Style: sandbox
Multitenant: Yes
Version: 21.5.53619.56709
Platform: 21.0.53597.56691
Generic Tag: 1.0.2.14
Container OS Version: 10.0.17763.3887 (ltsc2019)
Host OS Version: 10.0.17763.3887 (ltsc2019)
Using hyperv isolation
Using locale 
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Additional Parameters:
--env customNavSettings=EnableTaskScheduler=True
Files in C:\ProgramData\BcContainerHelper\Extensions\bcserver\my:
- AdditionalOutput.ps1
- MainLoop.ps1
- SetupDatabase.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container bcserver from image mcr.microsoft.com/businesscentral:10.0.17763.3887
Using Shared Encryption Key file
a5e6ff4096c618ac7f56b6c01bfcd7af2c91aa577e9f6bdd0f0913ed1acfd07f
Waiting for container bcserver to be ready
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
Using installer from C:\Run\210-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to 
start...
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\Program Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\WebSearch
Copying Web Client Files
c:\dl\sandbox\21.5.53619.56709\platform\WebClient\Microsoft Dynamics NAV
Copying ModernDev Files
c:\dl\sandbox\21.5.53619.56709\platform
c:\dl\sandbox\21.5.53619.56709\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\21.5.53619.56709\platform\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\21.5.53619.56709\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\21.5.53619.56709\lt\Extensions
Copying Applications
C:\dl\sandbox\21.5.53619.56709\platform\Applications
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Skipping restore of Cronus database
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Installation took 59 seconds
Installation complete
Initializing...
Setting host.containerhelper.internal to 172.18.96.1 in container hosts file
Starting Container
Hostname is bcserver
PublicDnsName is bcserver
Using NavUserPassword Authentication
Error restoring databases. Error was The script 'NAVWebClientManagement.psm1' cannot be run because it contains a "#requires" statement for running as Administrat
or. The current Windows PowerShell session is not running as Administrator. Start Windows PowerShell by  using the Run as Administrator option, and then try runni
ng the script again.
at <ScriptBlock>, C:\bcartifacts.cache\sandbox\21.5.53619.56709\platform\ServiceTier\program files\Microsoft Dynamics NAV\210\Service\Microsoft.Dynamics.Nav.Manag
ement.psm1: line 1
at <ScriptBlock>, <No file>: line 28Error
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
Using installer from C:\Run\210-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to 
start...
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\Program Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\WebSearch
Copying Web Client Files
c:\dl\sandbox\21.5.53619.56709\platform\WebClient\Microsoft Dynamics NAV
Copying ModernDev Files
c:\dl\sandbox\21.5.53619.56709\platform
c:\dl\sandbox\21.5.53619.56709\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\21.5.53619.56709\platform\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\21.5.53619.56709\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\21.5.53619.56709\lt\Extensions
Copying Applications
C:\dl\sandbox\21.5.53619.56709\platform\Applications
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Skipping restore of Cronus database
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Installation took 59 seconds
Installation complete
Initializing...
Setting host.containerhelper.internal to 172.18.96.1 in container hosts file
Starting Container
Hostname is bcserver
PublicDnsName is bcserver
Using NavUserPassword Authentication
Error restoring databases. Error was The script 'NAVWebClientManagement.psm1' cannot be run because it contains a "#requires" statement for running as Administrat
or. The current Windows PowerShell session is not running as Administrator. Start Windows PowerShell by  using the Run as Administrator option, and then try runni
ng the script again.
at <ScriptBlock>, C:\bcartifacts.cache\sandbox\21.5.53619.56709\platform\ServiceTier\program files\Microsoft Dynamics NAV\210\Service\Microsoft.Dynamics.Nav.Manag
ement.psm1: line 1
at <ScriptBlock>, <No file>: line 28
New-BcContainer Telemetry Correlation Id: d55d7f35-7c7f-47cc-8a3c-83dd340cea06
Initialization of container bcserver failed
At C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\5.0.2\ContainerHandling\Wait-NavContainerReady.ps1:42 char:17
+ ...             throw "Initialization of container $containerName failed" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Initialization ...bcserver failed:String) [], RuntimeException
    + FullyQualifiedErrorId : Initialization of container bcserver failed
freddydk commented 1 year ago

On the machine where it works as administrator - does it then fail as non-admin?

ernestasjuska commented 1 year ago

Tried on same machine with same administrator account.

Running in ISE as administrator:

PS C:\Windows\system32> Import-Module -Name BcContainerHelper -DisableNameChecking

$ContainerName = 'bcserver-adm'
# You can change this. Get-BCArtifactUrl -type OnPrem -country w1  gives the same error.
$BcArtifactUrl = Get-BCArtifactUrl -type Sandbox -country lt -version 21.5.53619; $BcArtifactUrl
$Credential = New-Object -TypeName pscredential -ArgumentList 'user', ('Password1.' | ConvertTo-SecureString -AsPlainText -Force)
$DatabaseCredential = New-Object -TypeName pscredential -ArgumentList 'sa', ('Password1.' | ConvertTo-SecureString -AsPlainText -Force)
$LicenseFile = 'C:\Users\ernjus\Desktop\BC21.bclicense'

$Container = @{
    accept_eula = $true
    containerName = $ContainerName
    isolation = 'hyperv'
    updateHosts = $true
    artifactUrl = $BcArtifactUrl
    auth = 'NavUserPassword'
    Credential = $Credential
    enableTaskScheduler = $true
    licenseFile = $LicenseFile
}
$Database = @{
    multitenant = $true
    databaseServer = 'host.containerhelper.internal'
    databaseInstance = 'SQL2019DEV'
    databasePrefix = "${ContainerName}-"
    databaseName = 'app'
    databaseCredential = $DatabaseCredential
    replaceExternalDatabases = $true
}
New-BcContainer @Container @Database
BcContainerHelper version 5.0.2
BC.HelperFunctions emits usage statistics telemetry to Microsoft
https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
BcContainerHelper is version 5.0.2
BcContainerHelper is running as administrator
HyperV is Enabled
UsePsSession is True
Host is Microsoft Windows Server 2019 Standard - 10.0.17763.3887
Docker Client Version is 19.03.5
Docker Server Version is 19.03.5
Removing Desktop shortcuts
Starting Database Restore job from https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\5.0.2\Import-BcContainerHelper.ps1
Fetching all docker images
Fetching all docker volumes
Using image mcr.microsoft.com/businesscentral:10.0.17763.3887
Creating Container bcserver-adm
Style: sandbox
Multitenant: Yes
Version: 21.5.53619.56709
Platform: 21.0.53597.56691
Generic Tag: 1.0.2.14
Container OS Version: 10.0.17763.3887 (ltsc2019)
Host OS Version: 10.0.17763.3887 (ltsc2019)
Using hyperv isolation
Using locale 
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file C:\Users\ernjus\Desktop\BC21.bclicense
Additional Parameters:
--env customNavSettings=EnableTaskScheduler=True
Files in C:\ProgramData\BcContainerHelper\Extensions\bcserver-adm\my:
- AdditionalOutput.ps1
- license.bclicense
- MainLoop.ps1
- SetupDatabase.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container bcserver-adm from image mcr.microsoft.com/businesscentral:10.0.17763.3887
Using Shared Encryption Key file
8be0308a3426252b9194fb12ae9b81cdeae8f2096632c15b3d4a5a15973b94ef
Waiting for container bcserver-adm to be ready
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
Using installer from C:\Run\210-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to 
start...
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\Program Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\WebSearch
Copying Web Client Files
c:\dl\sandbox\21.5.53619.56709\platform\WebClient\Microsoft Dynamics NAV
Copying ModernDev Files
c:\dl\sandbox\21.5.53619.56709\platform
c:\dl\sandbox\21.5.53619.56709\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\21.5.53619.56709\platform\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\21.5.53619.56709\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\21.5.53619.56709\lt\Extensions
Copying Applications
C:\dl\sandbox\21.5.53619.56709\platform\Applications
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Skipping restore of Cronus database
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Installation took 51 seconds
Installation complete
Initializing...
Setting host.containerhelper.internal to 172.18.96.1 in container hosts file
Starting Container
Hostname is bcserver-adm
PublicDnsName is bcserver-adm
Using NavUserPassword Authentication
Success
Import Encryption Key
Stopping local SQL Server
Creating Self Signed Certificate
Self Signed Certificate Thumbprint DDAD9E8DEB1451A14D18A18DFA95159C88F2D7C1
DNS identity bcserver-adm
Modifying Service Tier Config File with Instance Specific Settings
Modifying Service Tier Config File with settings from environment variable
Setting EnableTaskScheduler to True
Starting Service Tier
Registering event sources
Creating DotNetCore Web Server Instance
Using application pool name: BC
Using default container name: NavWebApplicationContainer
Copy files to WWW root C:\inetpub\wwwroot\BC
Create the application pool BC
Create website: NavWebApplicationContainer without SSL
Update configuration: navsettings.json
Done Configuring Web Client
Enabling Financials User Experience
Using license file 'c:\run\my\license.bclicense'
Import License
Creating http download site
Container IP Address: 172.18.99.136
Container Hostname  : bcserver-adm
Container Dns Name  : bcserver-adm
Web Client          : http://bcserver-adm/BC/?tenant=default
Dev. Server         : http://bcserver-adm
Dev. ServerInstance : BC
Dev. Server Tenant  : default
Setting bcserver-adm to 172.18.99.136 in host hosts file

Files:
http://bcserver-adm:8080/ALLanguage.vsix

WARNING: You are running a container which is 126 days old.
Microsoft recommends that you always run the latest version of our containers.

Container Total Physical Memory is 8.5Gb
Container Free Physical Memory is 6.8Gb

Initialization took 45 seconds
Ready for connections!
Reading CustomSettings.config from bcserver-adm
Creating Desktop Shortcuts for bcserver-adm
Creating Tenant default on bcserver-adm
Copying Database on host.containerhelper.internal\SQL2019DEV from bcserver-adm-tenant to bcserver-adm-default
EngineEdition 3
backup database [bcserver-adm-tenant] to disk = 'C:\Program Files\Microsoft SQL Server\MSSQL15.SQL2019DEV\MSSQL\DATA\bcserveradm\bcserver-adm-tenant.bak' with ini
t, stats=10;
restore database [bcserver-adm-default] from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL15.SQL2019DEV\MSSQL\DATA\bcserveradm\bcserver-adm-tenant.bak' with
 stats=10, recovery, move 'Navision_NAV_LT_Data' to 'C:\Program Files\Microsoft SQL Server\MSSQL15.SQL2019DEV\MSSQL\DATA\bcserveradm\bcserver-adm-default.mdf', mo
ve 'Navision_NAV_LT_Log' to 'C:\Program Files\Microsoft SQL Server\MSSQL15.SQL2019DEV\MSSQL\DATA\bcserveradm\bcserver-adm-default.ldf'
Mounting Database for default on server host.containerhelper.internal\SQL2019DEV with AllowAppDatabaseWrite = False
Sync'ing Tenant
Setting bcserver-adm-default to 172.18.99.136 in host hosts file
Setting bcserver-adm-default to 172.18.99.136 in container hosts file
Tenant successfully created
Creating User user
Assigning Permission Set SUPER to user
Container bcserver-adm successfully created

Use:
Get-BcContainerEventLog -containerName bcserver-adm to retrieve a snapshot of the event log from the container
Get-BcContainerDebugInfo -containerName bcserver-adm to get debug information about the container
Enter-BcContainer -containerName bcserver-adm to open a PowerShell prompt inside the container
Remove-BcContainer -containerName bcserver-adm to remove the container again
docker logs bcserver-adm to retrieve information about URL's again

Running in ISE without running as administrator:

PS C:\Users\ernjus> Import-Module -Name BcContainerHelper -DisableNameChecking

$ContainerName = 'bcserver'
# You can change this. Get-BCArtifactUrl -type OnPrem -country w1  gives the same error.
$BcArtifactUrl = Get-BCArtifactUrl -type Sandbox -country lt -version 21.5.53619; $BcArtifactUrl
$Credential = New-Object -TypeName pscredential -ArgumentList 'user', ('Password1.' | ConvertTo-SecureString -AsPlainText -Force)
$DatabaseCredential = New-Object -TypeName pscredential -ArgumentList 'sa', ('Password1.' | ConvertTo-SecureString -AsPlainText -Force)
$LicenseFile = 'C:\Users\ernjus\Desktop\BC21.bclicense'

$Container = @{
    accept_eula = $true
    containerName = $ContainerName
    isolation = 'hyperv'
    updateHosts = $true
    artifactUrl = $BcArtifactUrl
    auth = 'NavUserPassword'
    Credential = $Credential
    enableTaskScheduler = $true
    licenseFile = $LicenseFile
}
$Database = @{
    multitenant = $true
    databaseServer = 'host.containerhelper.internal'
    databaseInstance = 'SQL2019DEV'
    databasePrefix = "${ContainerName}-"
    databaseName = 'app'
    databaseCredential = $DatabaseCredential
    replaceExternalDatabases = $true
}
New-BcContainer @Container @Database
BcContainerHelper version 5.0.2
BC.HelperFunctions emits usage statistics telemetry to Microsoft
https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
BcContainerHelper is version 5.0.2
BcContainerHelper is not running as administrator
UsePsSession is False
Host is Microsoft Windows Server 2019 Standard - 10.0.17763.3887
Docker Client Version is 19.03.5
Docker Server Version is 19.03.5
Removing Session bcserver
Removing container bcserver
Removing entries from hosts
Removing bcserver from container hosts file
Removing bcserver-* from container hosts file
Removing Desktop shortcuts
Removing C:\ProgramData\BcContainerHelper\Extensions\bcserver
Starting Database Restore job from https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\5.0.2\Import-BcContainerHelper.ps1
Fetching all docker images
Fetching all docker volumes
Using image mcr.microsoft.com/businesscentral:10.0.17763.3887
Creating Container bcserver
Style: sandbox
Multitenant: Yes
Version: 21.5.53619.56709
Platform: 21.0.53597.56691
Generic Tag: 1.0.2.14
Container OS Version: 10.0.17763.3887 (ltsc2019)
Host OS Version: 10.0.17763.3887 (ltsc2019)
Using hyperv isolation
Using locale 
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file C:\Users\ernjus\Desktop\BC21.bclicense
Additional Parameters:
--env customNavSettings=EnableTaskScheduler=True
Files in C:\ProgramData\BcContainerHelper\Extensions\bcserver\my:
- AdditionalOutput.ps1
- license.bclicense
- MainLoop.ps1
- SetupDatabase.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container bcserver from image mcr.microsoft.com/businesscentral:10.0.17763.3887
Using Shared Encryption Key file
c439d1c42cfd5f28578230bab642d74577f3e4e58e6e078dcc964d82d5cee62d
Waiting for container bcserver to be ready
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
Using installer from C:\Run\210-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\Program Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\WebSearch
Copying Web Client Files
c:\dl\sandbox\21.5.53619.56709\platform\WebClient\Microsoft Dynamics NAV
Copying ModernDev Files
c:\dl\sandbox\21.5.53619.56709\platform
c:\dl\sandbox\21.5.53619.56709\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\21.5.53619.56709\platform\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\21.5.53619.56709\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\21.5.53619.56709\lt\Extensions
Copying Applications
C:\dl\sandbox\21.5.53619.56709\platform\Applications
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Skipping restore of Cronus database
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Installation took 49 seconds
Installation complete
Initializing...
Setting host.containerhelper.internal to 172.18.96.1 in container hosts file
Starting Container
Hostname is bcserver
PublicDnsName is bcserver
Using NavUserPassword Authentication
Error restoring databases. Error was The script 'NAVWebClientManagement.psm1' cannot be run because it contains a "#requires" statement for running as Administrat
or. The current Windows PowerShell session is not running as Administrator. Start Windows PowerShell by  using the Run as Administrator option, and then try runni
ng the script again.
at <ScriptBlock>, C:\bcartifacts.cache\sandbox\21.5.53619.56709\platform\ServiceTier\program files\Microsoft Dynamics NAV\210\Service\Microsoft.Dynamics.Nav.Manag
ement.psm1: line 1
at <ScriptBlock>, <No file>: line 28Error
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/21.5.53619.56709/lt
Using installer from C:\Run\210-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\Program Files
c:\dl\sandbox\21.5.53619.56709\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\21.5.53619.56709\platform\WindowsPowerShellScripts\WebSearch
Copying Web Client Files
c:\dl\sandbox\21.5.53619.56709\platform\WebClient\Microsoft Dynamics NAV
Copying ModernDev Files
c:\dl\sandbox\21.5.53619.56709\platform
c:\dl\sandbox\21.5.53619.56709\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\21.5.53619.56709\platform\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\21.5.53619.56709\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\21.5.53619.56709\lt\Extensions
Copying Applications
C:\dl\sandbox\21.5.53619.56709\platform\Applications
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Skipping restore of Cronus database
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Installation took 49 seconds
Installation complete
Initializing...
Setting host.containerhelper.internal to 172.18.96.1 in container hosts file
Starting Container
Hostname is bcserver
PublicDnsName is bcserver
Using NavUserPassword Authentication
Error restoring databases. Error was The script 'NAVWebClientManagement.psm1' cannot be run because it contains a "#requires" statement for running as Administrat
or. The current Windows PowerShell session is not running as Administrator. Start Windows PowerShell by  using the Run as Administrator option, and then try runni
ng the script again.
at <ScriptBlock>, C:\bcartifacts.cache\sandbox\21.5.53619.56709\platform\ServiceTier\program files\Microsoft Dynamics NAV\210\Service\Microsoft.Dynamics.Nav.Manag
ement.psm1: line 1
at <ScriptBlock>, <No file>: line 28
New-BcContainer Telemetry Correlation Id: 12dffaf9-c41c-4ac7-bd82-6b712a04e03a
Initialization of container bcserver failed
At C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\5.0.2\ContainerHandling\Wait-NavContainerReady.ps1:42 char:17
+ ...             throw "Initialization of container $containerName failed" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Initialization ...bcserver failed:String) [], RuntimeException
    + FullyQualifiedErrorId : Initialization of container bcserver failed

SetupWebClient.ps1 is not the only place that loads NAVWebClientManagement.psm1. It is imported when importing Microsoft.Dynamics.Nav.Management.psm1. Is there any easy way to get to know which part of code runs <ScriptBlock>, <No file>?

freddydk commented 1 year ago

Ahh - I was only looking for explicit loads. Yes, you are right that the Nav.Management library is probably loaded on the host. Will see what I can do about that

ernestasjuska commented 1 year ago

I dug around and it is possible to print scriptblock content from scriptblock itself. Maybe it would be useful to sprinkle these things in the code?

PS C:\Users\ernjus> $A = { write-host '>>>'; write-host $MyInvocation.MyCommand; write-host '<<<' }

PS C:\Users\ernjus> & $A
>>>
 write-host '>>>'; write-host $MyInvocation.MyCommand; write-host '<<<' 
<<<
ernestasjuska commented 1 year ago

These lines cause the Microsoft.Dynamics.Nav.Management.psm1 to load: https://github.com/microsoft/navcontainerhelper/blob/185b6d727c2c6fcd585e66e8e9f7cb44748dca10/Bacpac/Restore-BcDatabaseFromArtifacts.ps1#LL64C1-L84C53

It is a PowerShell job and it runs in host and not in container. It loads Microsoft.Dynamics.Nav.Management to use New-NAVDatabase, Export-NAVApplication, Remove-NAVApplication.

Restore-BcDatabaseFromArtifacts seems to do two things and both run in the container host:

  1. it puts the database backup file somewhere SQL server can access it - this part must run on container host;
  2. it restores database and maybe splits it into app+tenant databases (this part should run inside the container).

New-NAVDatabase takes file path and according the documentation it only needs to point to the file that SQL server can access so the backup file does not need to be shared with container: https://learn.microsoft.com/en-us/powershell/module/microsoft.dynamics.nav.management/new-navdatabase?view=businesscentral-ps-21 image

freddydk commented 1 year ago

Got it, thanks. Do you know whether this admin check is new for 21.5 - or has this always been like that?

freddydk commented 1 year ago

Thanks for the investigations. There are really 5 possible fixes for this:

  1. Remove the dependency on Microsoft.Dynamics.Nav.Management.psm1 form Restore-BcDatabaseFromArtifacts - I won't have the time to rewrite that function, sorry.

  2. Remove the administrator requirement from NAVWebClientManagement.psm1 - I actually think that requirement is there because that module is used to create the Web Site etc, which probably requires this - it would be a bug you need to file on the BC team and I am not sure they would accept this as a bug.

  3. Remove the dependency on NAVWebClientManagement.psm1 from Microsoft.Dynamics.Nav.Management.psm1 - - it would be a bug you need to file on the BC team and I am not sure they would accept this as a bug.

  4. Don't use -replaceExternalDatabases, but instead do things synchronously like this:

Remove-BcDatabase `
    -databaseServer $databaseParams.databaseServer `
    -databaseInstance $databaseParams.databaseInstance `
    -databaseName "$($databaseParams.databasePrefix)%"

Restore-BcDatabaseFromArtifacts `
    -artifactUrl $artifactUrl `
    -databaseServer $databaseParams.databaseServer `
    -databaseInstance $databaseParams.databaseInstance `
    -databasePrefix $databaseParams.databasePrefix `
    -databaseName $databaseParams.databaseName `
    -multitenant:$databaseParams.multitenant

New-BcContainer @databaseParams `
    -accept_eula `
    -containerName $containerName `
    -credential $credential `
    -auth $auth `
    -artifactUrl $artifactUrl `
    -licenseFile $licenseFile `
    -updateHosts `
    -dns 'hostDNS'

And then you can run the first 2 commands in an elevated PowerShell prompt.

  1. Instead of loading the .psm1 file in Restore-BcDatabaseFromArtifacts - just load the .dll directly (skipping the load of NAVWebClientManagement.psm1) - stumbled over this solution when I already had written the other points...:-)

Let's go with 5 - but obviously, you can also do 4. to do things synchronously and remove some of the async magic:-)

ernestasjuska commented 1 year ago

I will use 4th for now.

5th has a problem - in onprem\22.1.55890.56216 artifact management module dlls were moved into ...\Service\Management folder. I think better solution would be to use Invoke-ScriptInBcContainer and deal with database restore and splitting from inside of container - it has to be able to access database server so there is no reason to load NAV modules outside the container.

freddydk commented 1 year ago

Good point will add this fix as well.

freddydk commented 1 year ago

I guess #4 has the same problem with 22.x - should be fixed in the next update

freddydk commented 1 year ago

BTW - the reason for doing this outside the container is performance and also, if bakfile is very big (not the cronus) you run into problems in the container.

ernestasjuska commented 1 year ago

BTW - the reason for doing this outside the container is performance and also, if bakfile is very big (not the cronus) you run into problems in the container.

Yes, you are right that part does not needed a container. Also that function doesn't even have container parameter so yeah... :) But I still don't like the idea of loading NAV modules outside of docker container.

freddydk commented 1 year ago

Well, I respectfully disagree:-) Actually, if you look at the new functions called New-CompilerFolder and Compile-AppWithBcCompilerFolder - then things are going in the direction of doing more things without containers (especially in CI/CD pipelines), but also, restoring a database on a SQL Server on the host really don't need a container.

ernestasjuska commented 1 year ago

True, as long as it does not require admin permissions to restore database it counts as a solution to this problem.

freddydk commented 1 year ago

Yeah, that one is fixed in the next version.

freddydk commented 1 year ago

Shipped in 5.0.3