Navcontainerhelper: Question: Powershell 7 & BCContainerHelper

Created on 5 May 2021  路  13Comments  路  Source: microsoft/navcontainerhelper

As of today we have Powershell 5.1 installed on our machines and we have a bunch of scripts which run on a nightly basis or as adhoc scripts. For scripts using Microsoft Azure, Microsoft recommends to use Powershell 7.x and later.
My understanding is that Powershell 7.x is not fully backwards compatible.

My question is:

What do you recommend? Should we stick to Powershell 5.1 because of BCContainerHelper and use Powershell 7 only for "new" scripts where 7.x is required? Or does BCContainerHelper work with Powershell 7 and we can completely switch off Powershell 5.1?

enhancement

Most helpful comment

I am working on this as well. I have the image piece working and can get that uploaded, but I've had to do a bit of hacking to bccontainerhelper to run in the ACI context. Still don't have it working yet, but I am getting there. And I will share my results if I can get it working.

All 13 comments

BcContainerHelper is not compatible with PS Core (7) - and it is probably a fairly large task to make this happen.
One that I will be looking into - but haven't had time yet.

Thanks @freddydk

Maybe other users of the BCContainerHelper can share how they solve it?

I guess we'll have to stick to 5.1 for a while and only use 7.x in scripts where really needed.
And in those scripts we have to make sure not to call anything from the BCContainerHelper or other modules which are not Powershell 7.x ready.

@mitrov : we solved this by just not using anything above PS5. I have been able to make a fork of BcContainerHelper that runs in PS7.1+, but I only ever tried to make the "core" cmdlets work (New-BcContainer, Enter-BcContainer a.s.o.) but BcContainerHelper comes with a truckload more stuff.

I think the path forward here is to create a new project called BcContainerHelperCore (or like) and move the things over one by one probably leaving some things behind (everything C/AL and NAV like)
I hope that I will be able to work on this over the summer...

I assume it also depends when the standard BC cmdlets are going to work with Powershell 7?

Not really - the standard BC cmdlets are running inside the container

True that! So should we keep this github issue open so we don't forget about it? :-)

I have it on a todo list as well

If this gets converted to Core, I think we will be able to create docker containers directly in Azure using shell.azure.com. That has a small amount of persistent storage space (so that's where bccontainerhelper can be installed), but it runs in an ubuntu container, which only has core.

In order to make that work it is not "only" a port to core.
It also need to be able to work with ACI's directly.
today BcContainerHelper uses docker commands to communicate with Docker on the host machine - that would need to change as well I think.

Did not mean to offend by over-simplifying :) I'm going to try to make it work by building an image locally first. If I am successful, I will pass along my method (and code). At least my ACI powershell might be useful. But I'm not sure how to avoid the build-an-image-locally step.

No problem
I did investigate whether I could make New-BcContainer spin up ACI's instead of local containers at one point in time.
I didn't complete the work:-(
It would be nice to include this in a PS7 version of ContainerHelper
PS7 version of containerhelper is in the backlog

I am working on this as well. I have the image piece working and can get that uploaded, but I've had to do a bit of hacking to bccontainerhelper to run in the ACI context. Still don't have it working yet, but I am getting there. And I will share my results if I can get it working.

Was this page helpful?
0 / 5 - 0 ratings