microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
379 stars 243 forks source link

New-NavContainer -assignPremiumPlan and Entitlements? #3174

Open DanielGoehler opened 1 year ago

DanielGoehler commented 1 year ago

Describe the issue After reading throught Working with Development Sandboxes and Entitlements I created a docker container with New-NavContainer -assignPremiumPlan.

In the real cloud environment, the entitlements said that I wasn't allowed to modify the Sales Shipment Header directly. In my example report the permission wasn't set.

Entitlement in a Cloud Environment

When I run my exsample report in a real cloud environment. This will cause an error as expected.

Test Test 002

When I do the same in the cloud sandbox docker container, the report can change the Sales Shipment Header though. So when we are developing something, we have no way of knowing if my developed solution will work the same way in the real cloud environment. Screenshot 001

Screenshot 002

I've created a Cloud Sandbox with a premium user plan and I'm wondering why this Docker container doesn't behave like the real thing?

grafik

Scripts used to create container and cause the issue

New-BcContainer `
    -accept_eula `
    -alwaysPull `
    -updateHosts `
    -containername assignPremiumPlan `
    -artifactUrl "https://bcartifacts.azureedge.net/sandbox/22.4.59114.60133/de" `
    -PublicDnsName dockerhub.company.org `
    -useSSL `
    -useTraefik `
    -shortcuts None `
    -myscripts @("C:\ProgramData\company\SetupCertificate.ps1", "C:\ProgramData\company\companySSL.PFX") `
    -auth NavUserPassword `
    -Credential $credential `
    -licenseFile "C:\ProgramData\company\dockerLicenseFiles\lic.bclicense" `
    -assignPremiumPlan

Full output of scripts

BcContainerHelper is version 5.0.3
BcContainerHelper is running as administrator
HyperV is Enabled
UsePsSession is True
Host is Microsoft Windows Server 2019 Standard - 10.0.17763.4737
Docker Client Version is 19.03.5
Docker Server Version is 19.03.5
Removing Desktop shortcuts
Fetching all docker images
Fetching all docker volumes
Enabling SSL as otherwise all clients will see mixed HTTP / HTTPS request, which will cause problems e.g. on the mobile
 and modern windows clients
Pulling image mcr.microsoft.com/businesscentral:10.0.17763.4737
10.0.17763.4737: Pulling from businesscentral
Using image mcr.microsoft.com/businesscentral:10.0.17763.4737
PublicDnsName is dockerhub.company.org
Creating Container assignPremiumPlan
Style: sandbox
Multitenant: Yes
Version: 22.4.59114.60133
Platform: 22.0.60117.0
Generic Tag: 1.0.2.14
Container OS Version: 10.0.17763.4737 (ltsc2019)
Host OS Version: 10.0.17763.4737 (ltsc2019)
Using process isolation
Using locale de-DE
Adding special CheckHealth.ps1 to enable Traefik support
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file C:\ProgramData\company\dockerLicenseFiles\lic.bclicense
Additional Parameters:
-e webserverinstance=assignPremiumPlan
-e publicdnsname=dockerhub.company.org
-l "traefik.protocol=https"
-l "traefik.web.frontend.rule=PathPrefix:/assignPremiumPlan"
-l "traefik.web.port=443"
-l "traefik.soap.frontend.rule=PathPrefix:/assignPremiumPlansoap;ReplacePathRegex: ^/assignPremiumPlansoap(.*
) /BC$1"
-l "traefik.soap.port=7047"
-l "traefik.rest.frontend.rule=PathPrefix:/assignPremiumPlanrest;ReplacePathRegex: ^/assignPremiumPlanrest(.*
) /BC$1"
-l "traefik.rest.port=7048"
-l "traefik.dev.frontend.rule=PathPrefix:/assignPremiumPlandev;ReplacePathRegex: ^/assignPremiumPlandev(.*) /
BC$1"
-l "traefik.dev.port=7049"
-l "traefik.snap.frontend.rule=PathPrefix:/assignPremiumPlansnap;ReplacePathRegex: ^/assignPremiumPlansnap(.*
) /BC$1"
-l "traefik.snap.port=7083"
-l "traefik.dl.frontend.rule=PathPrefixStrip:/assignPremiumPlandl"
-l "traefik.dl.port=8080"
-l "traefik.dl.protocol=http"
-l "traefik.enable=true"
-l "traefik.frontend.entryPoints=https"
--env customNavSettings=PublicODataBaseUrl=https://dockerhub.company.org/assignPremiumPlanrest/odata,PublicSOAPBaseUrl=https://dockerhub.company.org/assignPremiumPlansoap/ws,PublicWebBaseUrl=https://dockerhub.company.org/assignPremiumPlan
Files in C:\ProgramData\BcContainerHelper\Extensions\assignPremiumPlan\my:
- AdditionalOutput.ps1
- CheckHealth.ps1
- license.bclicense
- MainLoop.ps1
- companySSL.PFX
- SetupCertificate.ps1
- SetupNavUsers.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container assignPremiumPlan from image mcr.microsoft.com/businesscentral:10.0.17763.4737
5d1ebf08f7b781775698647003d3518201875faa7378adcdf4a1eebadaa31106
Waiting for container assignPremiumPlan to be ready
Adding DAGO-ASSIGNPREM to hosts file
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/22.4.59114.60133/de
Using installer from C:\Run\210-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\22.4.59114.60133\platform\ServiceTier\Program Files
c:\dl\sandbox\22.4.59114.60133\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\22.4.59114.60133\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\22.4.59114.60133\platform\WindowsPowerShellScripts\WebSearch
Copying Web Client Files
c:\dl\sandbox\22.4.59114.60133\platform\WebClient\Microsoft Dynamics NAV
Copying ModernDev Files
c:\dl\sandbox\22.4.59114.60133\platform
c:\dl\sandbox\22.4.59114.60133\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\22.4.59114.60133\de\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\22.4.59114.60133\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\22.4.59114.60133\de\Extensions
Copying Applications
C:\dl\sandbox\22.4.59114.60133\platform\Applications
Copying Applications.DE
C:\dl\sandbox\22.4.59114.60133\de\Applications.DE
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Restoring CRONUS Demo Database
Setting CompatibilityLevel for tenant on localhost\SQLEXPRESS
Exporting Application to CRONUS
Removing Application from tenant
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Starting Business Central Service Tier
Importing license file
Copying Database on localhost\SQLEXPRESS from tenant to default
Taking database tenant offline
Copying database files
Attaching files as new Database default
Putting database tenant back online
Mounting tenant database
Mounting Database for default on server localhost\SQLEXPRESS with AllowAppDatabaseWrite = False
Sync'ing Tenant
Tenant is Operational
Stopping Business Central Service Tier
Installation took 306 seconds
Installation complete
Initializing...
Setting host.containerhelper.internal to 172.24.176.1 in container hosts file
Starting Container
Hostname is assignPremiumPlan
PublicDnsName is dockerhub.company.org
Using NavUserPassword Authentication
Certificate File Thumbprint 28EAC4018B94AB194E7F1E3FE451385C82C3AC1F
Import Certificate to LocalMachine\my
Modifying Service Tier Config File with Instance Specific Settings
Modifying Service Tier Config File with settings from environment variable
Setting PublicODataBaseUrl to https://dockerhub.company.org/assignPremiumPlanrest/odata
Setting PublicSOAPBaseUrl to https://dockerhub.company.org/assignPremiumPlansoap/ws
Setting PublicWebBaseUrl to https://dockerhub.company.org/assignPremiumPlan
Starting Service Tier
CertificateThumprint 28EAC4018B94AB194E7F1E3FE451385C82C3AC1F
Registering event sources
Creating DotNetCore Web Server Instance
Using application pool name: assignPremiumPlan
Using default container name: NavWebApplicationContainer
Copy files to WWW root C:\inetpub\wwwroot\assignPremiumPlan
Create the application pool assignPremiumPlan
Create website: NavWebApplicationContainer with SSL
Update configuration: navsettings.json
Done Configuring Web Client
Enabling Financials User Experience
Using license file 'c:\run\my\license.bclicense'
Import License
Dismounting Tenant
Mounting Tenant
Mounting Database for default on server localhost\SQLEXPRESS with AllowAppDatabaseWrite = False
Sync'ing Tenant
Tenant is Operational
Creating http download site
Setting SA Password and enabling SA
Creating admin as SQL User and add to sysadmin
Creating SUPER user
Assign Premium plan for ADMIN
Container IP Address: 172.24.177.210
Container Hostname  : assignPremiumPlan
Container Dns Name  : dockerhub.company.org
Web Client          : https://dockerhub.company.org/assignPremiumPlan/?tenant=default
Dev. Server         : https://dockerhub.company.org
Dev. ServerInstance : BC
Dev. Server Tenant  : default
Setting assignPremiumPlan to 172.24.177.210 in host hosts file
Setting assignPremiumPlan-default to 172.24.177.210 in host hosts file
Setting assignPremiumPlan-default to 172.24.177.210 in container hosts file

Files:
http://dockerhub.company.org:8080/ALLanguage.vsix

Container Total Physical Memory is 511.9Gb
Container Free Physical Memory is 236.9Gb

Initialization took 43 seconds
Ready for connections!
Reading CustomSettings.config from assignPremiumPlan
Cleanup old dotnet core assemblies
Container assignPremiumPlan successfully created
Because of Traefik, the following URLs need to be used when accessing the container from outside your Docker host:
Web Client:        https://dockerhub.company.org/assignPremiumPlan
SOAP WebServices:  https://dockerhub.company.org/assignPremiumPlansoap
OData WebServices: https://dockerhub.company.org/assignPremiumPlanrest
Dev Service:       https://dockerhub.company.org/assignPremiumPlandev
Snapshot Service:  https://dockerhub.company.org/assignPremiumPlansnap
File downloads:    https://dockerhub.company.org/assignPremiumPlandl
Health check returns False, restarting container
Removing Session assignPremiumPlan
assignPremiumPlan
Waiting for container assignPremiumPlan to be ready

Initializing...
Setting host.containerhelper.internal to 172.24.176.1 in container hosts file
Restarting Container
PublicDnsName unchanged
Hostname is assignPremiumPlan
PublicDnsName is dockerhub.company.org
Using NavUserPassword Authentication
Starting Local SQL Server
Starting Internet Information Server
Starting Service Tier
Container IP Address: 172.24.182.244
Container Hostname  : assignPremiumPlan
Container Dns Name  : dockerhub.company.org
Web Client          : https://dockerhub.company.org/assignPremiumPlan?tenant=default
Dev. Server         : https://dockerhub.company.org
Dev. ServerInstance : BC
Dev. Server Tenant  : default
Setting assignPremiumPlan to 172.24.182.244 in host hosts file
Setting assignPremiumPlan-default to 172.24.182.244 in host hosts file
Setting assignPremiumPlan-default to 172.24.182.244 in container hosts file

Files:
http://dockerhub.company.org:8080/ALLanguage.vsix

Container Total Physical Memory is 511.9Gb
Container Free Physical Memory is 239.7Gb

Initialization took 12 seconds
Ready for connections!
Waiting for tenants to be mounted

Use:
Get-BcContainerEventLog -containerName assignPremiumPlan to retrieve a snapshot of the event log from the containe
r
Get-BcContainerDebugInfo -containerName assignPremiumPlan to get debug information about the container
Enter-BcContainer -containerName assignPremiumPlan to open a PowerShell prompt inside the container
Remove-BcContainer -containerName assignPremiumPlan to remove the container again
docker logs assignPremiumPlan to retrieve information about URL's again
...
report 50100 "Set Package Tracking No."
{
    UsageCategory = ReportsAndAnalysis;
    ApplicationArea = All;
    ProcessingOnly = true;

    dataset
    {
        dataitem(SalesShipmentHeader; "Sales Shipment Header")
        {
            trigger OnAfterGetRecord()
            begin
                SalesShipmentHeader."Package Tracking No." := 'Test';
                SalesShipmentHeader.Modify();
                Message('Sales Shipment Header successfully modified.');
                CurrReport.Break();
            end;

        }
    }
}
gntpet commented 7 months ago

@DanielGoehler , i wonder if you found answer to your question. Ran into the same question today :)

DanielGoehler commented 7 months ago

@gntpet Unfortunately, there is still no solution.