microsoft / nav-docker

Official Microsoft repository for Dynamics NAV in Docker resources. It has not been decided yet, to which extend Microsoft will ship Docker images with NAV, so everything in this repo is work in progress and might be subject to deletion.
MIT License
180 stars 92 forks source link

Invoke-NavContainerCodeunit and Credentials #400

Closed kylehardin6 closed 5 years ago

kylehardin6 commented 5 years ago

Invoke-NavContainerCodeunit does not seem to work with NavUserPassword. It's fine with windows authentication, but with NavUserPassword, the NST says that the operation cannot be completed.


$containerName = 'CKS' $companyName = "CKS Packaging" $navApp = Resolve-Path "..\ArcherPoint_CKSPackaging_1.0.0.0.app" $hostPackageFile = Resolve-Path "..\Rapid\CKS.rapidstart" $credential = get-credential -Message "Using NavUserPassword Authentication. Please enter username/password for the Containter."

this works

Publish-NavContainerApp -useDevEndpoint -containerName $containerName -credential $credential -appFile $navApp -skipVerification -sync Add -install -tenant default

this does not

$containerPackageFile = Split-Path $hostPackageFile -leaf Copy-Item $hostPackageFile c:\share\ $containerPackageFile = "c:\share\" + $containerPackageFile $params = @{ 'containerName' = $containerName } $params += @{ 'companyName' = $companyName } $params += @{ 'codeunitId' = 8620 } $params += @{ 'methodName' = 'ImportAndApplyRapidStartPackage' } $params += @{ 'argument' = $containerPackageFile } Write-Host "Importing " $hostPackageFile Invoke-NavContainerCodeunit @params -ErrorAction Continue

freddydk commented 5 years ago

You don't specify the image you use, but I assume you are using Business Central and that this is a bug in Business Central (not sure whether it ever got/will get fixed). As a result of this, I changed all the places where I use invoke codeunit to instead invoke an API (which I expose in my app), It is a much cleaner solution anyway and fairly easy. Described here: https://freddysblog.com/2019/03/27/navcontainerhelper-0-5-0-11/

kylehardin6 commented 5 years ago

Yes, BC14. I will give that a try.

freddydk commented 5 years ago

Yeah, so you are running into this platform bug, which I don't know whether it ever will get fixed (as the API route is better and more future-safe).

kylehardin6 commented 5 years ago

So far, they have not fixed it - I just applied CU2 and it still does the same thing. I will try the API.