New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SqlServer module not found #3516
Comments
Full log? |
and... |
I've added just the import step infront of the backup-navcontainer. I'll check and let you know. |
So I changed code to this... But failed like this... Exception Script Stack Trace: PowerShell Call Stack: Container Free Physical Memory: 46.8Gb |
When you use -usepwsh:$false - SqlServer module is NOT available and pscoreoverrides should never be included. Are you including pscoreoverrides overrides yourself? |
I guess found the issue. Part of the upgrade process I'm performing this step:
As you can see it has -usePwsh:$false, without this change it will fail with an error. |
Error when not using option UsePwsh VERBOSE: Restore app database from bacpac Exception Script Stack Trace: PowerShell Call Stack: Container Free Physical Memory: 19.2Gb Services in container demo:
|
Any idea from which repo this function is comming? |
Restore-BacpacWithRetry is from HelperFunctions inside the generic image (nav-docker repo) |
I added following to the script when restoring the bacpac but it keeps failing at the backup-navcontainer later in the process. Invoke-ScriptInNAVContainer -containerName $ContainerName -Scriptblock $ScriptBlock -ArgumentList $BacpacFile, $ContainerConfig.DatabaseName -usePwsh $false -useSession $false I'll try to create a repo scenario for this. |
I have a repro on my laptop... Grapping it into script(s) for you and will send it in a presonal mail.
It will crash at the last script when trying to make backup... Allthough backups works in the first script (SimpleDemoContainer-Artifacts.ps1 ). |
Replied with a workaround on how to modify your code on email |
I tested this, but now it fails on step: The tenant 'default' is not mounted or does not exist. Exception Script Stack Trace: PowerShell Call Stack: Somehow the default tenant doesnt exist anymore after switching to Single tenant. I can workaround this I guess using invoke-script instead Remove-NavContainerCompany |
Found rootcause the script to convert to single tenant contained a statement: Before exporting the App.DB and moving it into the tenant DB. Somehow the behavior is different now. In the past it got mounted by defaullt somehow... I removed the dismounting And now it continues. As we are only using single tenant in DEV environments for this case can be closed. But this might be something from the server team to look into as its changed behavior. |
This is likely because your scriptblock had a switch parameter and then it also read that value from args[0] - that doesn't work - I changed that (as I also saw that problem). |
Removing the dismount in my script when transforming to single tenant also solved the problem. Tested on both 23.x and 24x and all is fine. Thx for support again! |
Tested with pre-release: BcContainerHelper is version 6.0.16
Create a multi tenant container based on artifact: https://bcartifacts.azureedge.net/sandbox/24.0.16410.18040/nl
After creating the multtenant container:
Sync / upgrade environment all went well
Bacpacs created without problems
For development purposes we transform the DB into Single tenant again
Move all apps to DevEndpoint
When invoking the Backup-Navdatabases receive following error:
Backup-NavContainerDatabases -containerName "$ContainerName"
-bakFolder "$BackupFolder"
-Verbose
Backing up default to c:\s-Extensions\database\database.bak
The module 'SqlServer' could not be loaded. For more information, run 'Import-Module SqlServer'.
Exception Script Stack Trace:
at Backup-SqlDatabase, C:\run\pscoreoverrides.ps1: line 2
at Backup, : line 20
at , : line 65
PowerShell Call Stack:
at Invoke-ScriptInBcContainer, C:\Users\buildadmin2\Documents\WindowsPowerShell\Modules\bccontainerhelper\6.0.16\ContainerHandling\Invoke-ScriptInNavContainer.ps1: line 71
at Backup-BcContainerDatabases, C:\Users\buildadmin2\Documents\WindowsPowerShell\Modules\bccontainerhelper\6.0.16\Bacpac\Backup-NavContainerDatabases.ps1: line 52
at , C:\agent2_work\64\s\DevOps.Builds\ERP AL\Invoke-Master-CreateDevelopmentDB.ps1: line 103
at , : line 1
at , C:\agent2_work_tasks\AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62\4.238.7\azurepowershell.ps1: line 261
at , C:\agent2_work_tasks\AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62\4.238.7\azurepowershell.ps1: line 257
at , : line 1
at , : line 22
at , : line 18
at , : line 1
Currently trying with workaround :
New-cdsaAzureDevOpsSection -Message "Workaround BC24 - Install SqlServer module"
Invoke-ScriptInNavContainer -containerName $ContainerName -usePwsh:$false -scriptblock {
Install-Module PowerShellGet -AllowClobber -Force -verbose -Repository PSGallery
Install-Module -Name SqlServer -RequiredVersion 21.1.18256 -Force -AllowClobber
}
The text was updated successfully, but these errors were encountered: