Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion ContainerHandling/New-NavContainer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2308,14 +2308,28 @@ if (-not `$restartingInstance) {
Set-NavserverInstance -ServerInstance $serverInstance -stop
Copy-NavDatabase -SourceDatabaseName $databaseName -DestinationDatabaseName "tenant"
Remove-NavDatabase -DatabaseName $databaseName
Write-Host "Exporting Application to $DatabaseName"
Invoke-sqlcmd -serverinstance "$DatabaseServer\$DatabaseInstance" -Database tenant -query 'CREATE USER "NT AUTHORITY\SYSTEM" FOR LOGIN "NT AUTHORITY\SYSTEM";'
}

# mitigate issue with Microsoft.SqlServer.SmoExtended assembly
# Could not load type 'Microsoft.SqlServer.Management.Common.TransferException' (caused by legacy loaded assemblies in upper stack)
Remove-BcContainerSession -ContainerName $containerName

Invoke-ScriptInBCContainer -containerName $containerName -scriptblock {
$customConfigFile = Join-Path (Get-Item "C:\Program Files\Microsoft Dynamics NAV\*\Service").FullName "CustomSettings.config"
[xml]$customConfig = [System.IO.File]::ReadAllText($customConfigFile)
$databaseServer = $customConfig.SelectSingleNode("//appSettings/add[@key='DatabaseServer']").Value
$databaseInstance = $customConfig.SelectSingleNode("//appSettings/add[@key='DatabaseInstance']").Value
$databaseName = $customConfig.SelectSingleNode("//appSettings/add[@key='DatabaseName']").Value

Write-Host "Exporting Application to $DatabaseName"
Export-NAVApplication -DatabaseServer $DatabaseServer -DatabaseInstance $DatabaseInstance -DatabaseName "tenant" -DestinationDatabaseName $databaseName -Force -ServiceAccount 'NT AUTHORITY\SYSTEM' | Out-Null
Write-Host "Removing Application from tenant"
Remove-NAVApplication -DatabaseServer $DatabaseServer -DatabaseInstance $DatabaseInstance -DatabaseName "tenant" -Force | Out-Null
Set-NAVServerConfiguration -ServerInstance $ServerInstance -KeyName "Multitenant" -KeyValue "true" -ApplyTo ConfigFile
Set-NavserverInstance -ServerInstance $serverInstance -start
}

$allowAppDatabaseWrite = ($additionalparameters | Where-Object { $_ -like "*defaultTenantHasAllowAppDatabaseWrite=Y" }) -ne $null
New-BcContainerTenant -containerName $containerName -tenantId default -allowAppDatabaseWrite:$allowAppDatabaseWrite
}
Expand Down
1 change: 1 addition & 0 deletions ReleaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ When two projects reference the same folder during build (e.g. one for build and
Increase performance when using compilerfolders on Windows
Issue 4112 In a multi-project repository, using CompilerFolders and online environments or custom images, installOnlyReferencedApps is ignored
Disable PSSessions for BC v28+ containers by default due to known PS7 remote session issue. Uses docker exec instead. Set usePsSessionForBc28 to true to re-enable. See https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/upgrade/known-issues
Create new PSSession after executing Invoke-SqlCmd cmdlet to prevent assemblies conflict with Business Central cmdlets while creating new container using either useCleanDatabase or useNewDatabase switch on New-BcContainer (#4051)

6.1.11
Temporarily avoid using dotnet 10 for assemblyProbingPaths
Expand Down