Skip to content

[Bug]: Backup-BcContainerDatabases fails with BC29 multitenancy containers #4186

Description

BCContainerhelper version

6.1.16-preview2667550

Describe the issue

When running Backup-BcContainerDatabases on a container with BC29 (multitenant) it fails with:
The tenant 'tenant' is not mounted or does not exist.

Containers with <BC29 it works fine

Command or script used to produce the issue

Create a BC container with version 29
Run following command

$containerName = 'NameOfYourContainer'
Backup-BcContainerDatabases -containerName $containerName -bakFolder "C:\ProgramData\BcContainerHelper\Extensions\$($containerName)\my\"

Full output of the command or script

PS C:\Users\xyz> Backup-BcContainerDatabases -containerName $containerName -bakFolder C:\ProgramData\BcContainerHelper\Extensions\BC\my\
BcContainerHelper version 6.1.16-preview2667550
BC.HelperFunctions emits usage statistics telemetry to Microsoft
Running on Windows, PowerShell 5.1.26100.33158
Backing up CRONUS to C:\ProgramData\BcContainerHelper\Extensions\BC\my\app.bak
Backing up default to C:\ProgramData\BcContainerHelper\Extensions\BC\my\default.bak
The tenant 'tenant' is not mounted or does not exist.

Container Free Physical Memory: 19.0Gb
Disk C: Free 120Gb from 127Gb

Services in container BC:
- MicrosoftDynamicsNavServer$BC is Running
- MSSQL$SQLEXPRESS is Running

Backup-BcContainerDatabases Telemetry Correlation Id: 7bb02865-42a2-433a-a128-9935d372e93d
The tenant 'tenant' is not mounted or does not exist.
At C:\Program
Files\WindowsPowerShell\Modules\BcContainerHelper\6.1.16\ContainerHandling\Invoke-ScriptInNavContainer.ps1:314 char:25
+                         throw $errorMessage
+                         ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The tenant 'ten...does not exist.:String) [], RuntimeException
    + FullyQualifiedErrorId : The tenant 'tenant' is not mounted or does not exist.

Additional information

I already investigated into that and figured out it seems to be a problem with how Invoke-ScriptInBcContainer is called in Backup-BcContainerDatabases
It gets invoked with -useSession:$false

The error The tenant 'tenant' is not mounted or does not exist. comes from this line. It seems like the -ErrorAction SilentlyContinue is getting ignored.

I modified the function locally setting -ErrorAction to Ignore but it didnt work.
Then i tried -useSession:$true and it worked.

PS C:\Users\xyz> .\Test.ps1
Backing up CRONUS to C:\ProgramData\BcContainerHelper\Extensions\BC\my\app.bak
Backing up default to C:\ProgramData\BcContainerHelper\Extensions\BC\my\default.bak
Backing up tenant to C:\ProgramData\BcContainerHelper\Extensions\BC\my\tenant.bak

Does this happen every time?

Yes

Did this used to work?

No
Internal work item: AB#648571

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThe issue has been accepted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions