Skip to content
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

Publish-PerTenantExtensionApps in BC 24 sandox fails on every app. #3495

Closed
Jupentti1 opened this issue Apr 17, 2024 · 6 comments
Closed

Publish-PerTenantExtensionApps in BC 24 sandox fails on every app. #3495

Jupentti1 opened this issue Apr 17, 2024 · 6 comments

Comments

@Jupentti1
Copy link

Jupentti1 commented Apr 17, 2024

Describe the issue
We have a workspace with 10 apps in Azure DevOps. At the moment we are experiencing in CD pipeline that Publish-PerTenantExtensionApps fails on every extension, complaining that the app is already installed in the tenant. The app is left in published, not installed state.
If pipeline is run again the published, not installed app is upgraded/installed and the same thing happens to the next in line app. The first round of installation to sandbox was successfully completed. We are targeting BC 24 sandbox and using latest 24 artifacts build in CI pipeline.

Are we doing something wrong or is there some changes that we have completely missed?
Tried to use both BcContainerHelper version 6.0.16-preview1181 and BcContainerHelper version 6.0.15.

Looked into admin center and there was different error:
_Operation Details:
Status: Failed
Error: A request to the Data Plane Admin Service failed. Http status code: BadRequest Error: { "code": "ExtensionChangeFailed", "message": "An app with package ID 'a3d50fff-ca9f-42cf-83e6-a77be66c4b5d' is already published for tenant 'msneua2132t93655432'", "innerError": { "code": "AppAlreadyPublished" } }
Application ID: 5a33407b-8e23-44c4-912c-72e16ef5XXXX
Source App Version: 24.0.2848.0
Target App Version: 24.0.2877.0
Country: FI
Allow Preview Version: true
Ignore update window: true
Allow Dependency Update: true

Operation Time:
Scheduled on: 17.4.2024 15.25.10
Started on: 17.4.2024 15.25.10
Completed on: 17.4.2024 15.26.53_

Scripts used to create container and cause the issue

Write-Host "Installing BcContainerHelper"
Install-Module BcContainerHelper -Force -AllowPrerelease

Write-Host "Publishing to tenant"
Publish-PerTenantExtensionApps -useNewLine `
 -ClientID "$(PublisherAppClientID)" `
 -ClientSecret "$(PublisherAppClientSecret)" `
 -tenantId "$(TenantId)" `
 -environment "$(Environment)" `
 -companyName "$(CompanyName)" `
 -appFiles @(Get-Item "_DailyMain/output/Apps/*.app" | % { $_.FullName })

or 

Write-Host "Installing BcContainerHelper"
Install-Module BcContainerHelper -Force 

Write-Host "Publishing to tenant"
Publish-PerTenantExtensionApps -useNewLine `
 -ClientID "$(PublisherAppClientID)" `
 -ClientSecret "$(PublisherAppClientSecret)" `
 -tenantId "$(TenantId)" `
 -environment "$(Environment)" `
 -companyName "$(CompanyName)" `
 -appFiles @(Get-Item "_DailyMain/output/Apps/*.app" | % { $_.FullName })

Full output of scripts

BcContainerHelper version 6.0.16-preview1181:
2024-04-17T10:57:19.3863452Z ##[section]Starting: PowerShell Script
2024-04-17T10:57:19.3984488Z ==============================================================================
2024-04-17T10:57:19.3984652Z Task         : PowerShell
2024-04-17T10:57:19.3984751Z Description  : Run a PowerShell script on Linux, macOS, or Windows
2024-04-17T10:57:19.3984855Z Version      : 2.237.5
2024-04-17T10:57:19.3984921Z Author       : Microsoft Corporation
2024-04-17T10:57:19.3985019Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2024-04-17T10:57:19.3985137Z ==============================================================================
2024-04-17T10:57:22.3357085Z Generating script.
2024-04-17T10:57:22.4753659Z ========================== Starting Command Output ===========================
2024-04-17T10:57:22.5061513Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\14aeae5b-f563-411b-ace9-6652c62ae50e.ps1'"
2024-04-17T10:57:22.8103475Z Installing BcContainerHelper
2024-04-17T11:00:06.1538096Z Publishing to tenant
2024-04-17T11:00:06.5711435Z BcContainerHelper version 6.0.16-preview1181
2024-04-17T11:00:07.6187941Z BC.HelperFunctions emits usage statistics telemetry to Microsoft
2024-04-17T11:00:07.7618004Z Running on Windows, PowerShell 5.1.17763.5576
2024-04-17T11:00:10.7201648Z Attempting authentication to https://api.businesscentral.dynamics.com/.default using clientCredentials...
2024-04-17T11:00:10.8809086Z Authenticated as app ***
....
2024-04-17T11:01:21.5802491Z completed
2024-04-17T11:01:21.8830685Z Extension_Extension1_24.0.2877.0.app - upgrading
2024-04-17T11:01:21.9241702Z .
2024-04-17T11:01:21.9823791Z .
2024-04-17T11:01:22.0577418Z .
2024-04-17T11:01:23.5766711Z .
2024-04-17T11:01:53.7650715Z .
2024-04-17T11:01:58.9873557Z .
2024-04-17T11:02:04.2620745Z .
2024-04-17T11:02:09.4704147Z .
2024-04-17T11:02:14.6570056Z .
2024-04-17T11:02:19.8657339Z .
2024-04-17T11:02:25.0502878Z .
2024-04-17T11:02:30.2442115Z .
2024-04-17T11:02:35.4335251Z .
2024-04-17T11:02:40.6212705Z .
2024-04-17T11:02:45.8125848Z .
2024-04-17T11:02:51.0113574Z .
2024-04-17T11:02:56.1915865Z .
2024-04-17T11:03:01.4152351Z .
2024-04-17T11:03:06.6046846Z .
2024-04-17T11:03:11.8225633Z .
2024-04-17T11:03:17.0271436Z .
2024-04-17T11:03:22.2601826Z .
2024-04-17T11:03:27.4353673Z .
2024-04-17T11:03:32.6539180Z .
2024-04-17T11:03:37.9382796Z Failed
2024-04-17T11:03:37.9489335Z ERROR: Unable to publish app. Please open the Extension Deployment Status Details page in Business Central to see the detailed error message. [System.Management.Automation.RuntimeException]


BcContainerHelper version 6.0.15
2024-04-17T11:45:48.8018828Z ##[section]Starting: PowerShell Script
2024-04-17T11:45:48.8131038Z ==============================================================================
2024-04-17T11:45:48.8131196Z Task         : PowerShell
2024-04-17T11:45:48.8131268Z Description  : Run a PowerShell script on Linux, macOS, or Windows
2024-04-17T11:45:48.8131372Z Version      : 2.237.5
2024-04-17T11:45:48.8131439Z Author       : Microsoft Corporation
2024-04-17T11:45:48.8131533Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2024-04-17T11:45:48.8131651Z ==============================================================================
2024-04-17T11:45:49.8546932Z Generating script.
2024-04-17T11:45:49.8968689Z ========================== Starting Command Output ===========================
2024-04-17T11:45:49.9259993Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\3c410535-e4bf-4d09-b338-f1a2e23f192d.ps1'"
2024-04-17T11:45:50.2451448Z Installing BcContainerHelper
2024-04-17T11:48:10.7036503Z Publishing to tenant
2024-04-17T11:48:10.9525075Z BcContainerHelper version 6.0.15
2024-04-17T11:48:11.8720114Z BC.HelperFunctions emits usage statistics telemetry to Microsoft
2024-04-17T11:48:12.0055055Z Running on Windows, PowerShell 5.1.17763.5696
2024-04-17T11:48:14.8679956Z Attempting authentication to https://api.businesscentral.dynamics.com/.default using clientCredentials...
2024-04-17T11:48:15.2389649Z Authenticated as app ***
...
2024-04-17T11:48:37.8668630Z Extension_Extension2_24.0.2877.0.app - upgrading
2024-04-17T11:48:37.8669055Z .
2024-04-17T11:48:37.8676877Z .
2024-04-17T11:48:37.8677142Z .
2024-04-17T11:48:38.7062839Z .
2024-04-17T11:49:09.0035465Z .
2024-04-17T11:49:14.6566613Z .
2024-04-17T11:49:19.5413736Z .
2024-04-17T11:49:24.8221338Z .
2024-04-17T11:49:30.0863930Z .
2024-04-17T11:49:35.3176399Z .
2024-04-17T11:49:40.5708053Z .
2024-04-17T11:49:45.8206299Z .
2024-04-17T11:49:51.0629266Z .
2024-04-17T11:49:56.3017950Z .
2024-04-17T11:50:01.5734249Z .
2024-04-17T11:50:06.8243688Z .
2024-04-17T11:50:12.0843828Z .
2024-04-17T11:50:17.3684096Z .
2024-04-17T11:50:22.6236537Z .
2024-04-17T11:50:27.8939073Z .
2024-04-17T11:50:33.2010007Z .
2024-04-17T11:50:38.4593767Z .
2024-04-17T11:50:43.7724982Z .
2024-04-17T11:50:48.9480007Z .
2024-04-17T11:50:54.2017834Z .
2024-04-17T11:50:59.4494548Z .
2024-04-17T11:51:04.7006293Z .
2024-04-17T11:51:09.9539450Z .
2024-04-17T11:51:15.2130216Z .
2024-04-17T11:51:20.4714325Z .
2024-04-17T11:51:25.7542358Z .
2024-04-17T11:51:30.9875952Z .
2024-04-17T11:51:36.2493005Z .
2024-04-17T11:51:42.0306246Z Failed
2024-04-17T11:51:42.0307725Z ERROR: Unable to publish app. Please open the Extension Deployment Status Details page in Business Central to see the detailed error message. [System.Management.Automation.RuntimeException]
...

Screenshots
image
image

Additional context

  • It happens all the time
  • It used to work.
@freddydk
Copy link
Contributor

Could you try to use:

Replace-DependenciesInAppFile -Path $appFile -replacePackageId

before publishing the app and see whether this fixes the issue?

@freddydk
Copy link
Contributor

It looks like the problem is in the service and unrelated to BcContainerHelper.
We have people looking into this.

@freddydk
Copy link
Contributor

microsoft/AL#7721

@jmarinLaberit
Copy link

jmarinLaberit commented Apr 24, 2024

This issue also affects the copy of environments in the Admin Center

@freddydk
Copy link
Contributor

Yeah - I think they are aware of this and are working many people on finding a solution.
I did have one CI/CD passing today, but I think that is more a coincidence and it works sometimes.

@freddydk
Copy link
Contributor

This should be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants