Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix read environment variable when backup or restoring db (#3615)
In some situations the reading of environment variables from the container not works as expected with the `Invoke-ScriptInBcContainer` cmdlt, f.i. the latest online sandbox (version 24.4.22295.23050) for Italy on a self-hosted agent not returns any value, on an on-prem sandbox (version 23 and also version 24) instead returns a value as expected. The following statement was launched on pwsh 7.4.2 with docker version 20.10.21, but returns no value: ```pwsh Invoke-ScriptInBcContainer -containerName $containerName -scriptblock { $env:IsBcSandbox } ``` Using the following fix for this issue works as expected, and is much more faster then invoking the script: ```pwsh $inspect = docker inspect $containerName | ConvertFrom-Json $inspect.Config.Env | Where-Object { $_ -eq "IsBcSandbox=Y" } ``` --------- Co-authored-by: Freddy Kristiansen <freddy.kristiansen@microsoft.com>
- Loading branch information