navcontainerhelper icon indicating copy to clipboard operation
navcontainerhelper copied to clipboard

Ability to unpublish specific version number of an extension in a SaaS environment

Open scm6iwa opened this issue 2 years ago • 16 comments

This isn't an issue but more of a request.

Could you create a Unpublish-PerTenantExtensionApps script where you can unpublish specific versions of an extension in a BCSaaS environment.

This would be useful so when I publish an extension using Publish-PerTenantExtensionApps to my SaaS sandboxes via my pipeline's I can then also unpublish the uninstalled extensions to keep the sandbox environments clean of none installed extensions.

scm6iwa avatar Nov 30 '22 14:11 scm6iwa

Hi Freddy, I think my requests relates to this issue: I'd like to uninstall some dev-apps from a SaaS environment. Publish-BCContainerApp e.g. works fine with with the parameters bcAuthContext and environment, but it seems that Unpbulish-BcContainerApp is missing these parameters. Is that doable?

DavidFeldhoff avatar Jan 10 '23 15:01 DavidFeldhoff

The alternative would be to uninstall apps via the BC Admin API. But unfortunately that isn't working for dev-extensions. @freddydk can you maybe give a short statement if you would pick this up? Otherwise I'd create a support request for the BC Admin API that the uninstall endpoint https://api.businesscentral.dynamics.com/admin/v2.11/applications/BusinessCentral/environments/$environmentName/apps/$appIdToUninstall/uninstall should work for dev-extensions as well, but I could assume that they'd refuse it.

DavidFeldhoff avatar Jan 10 '23 16:01 DavidFeldhoff

I will investigate what can be done.

freddydk avatar Jan 10 '23 19:01 freddydk

Awesome, thanks!

DavidFeldhoff avatar Jan 10 '23 20:01 DavidFeldhoff

Hello Freddy! Do you have any news regarding this topic? Thanks!

MikelSeron avatar Mar 22 '23 15:03 MikelSeron

Hello @freddydk, are there already some news?

Spycoclown avatar May 05 '23 11:05 Spycoclown

It should be possible to uninstall and unpublish apps through the automation API: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/resources/dynamics_extension#bound-actions

or through the admin center API https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/administration-center-api_app_management#uninstall-an-app

The automation API should work for both Dev scope and PTEs

I haven't tried and won't have time to investigate right now, if anybody wants to submit a PR with a new function, I will find the time to review.

freddydk avatar May 05 '23 17:05 freddydk

At a first glance: The automation API does not offer a bound action to unpublish extensions. The admin center API only lists AppSource or firstparty apps, so Dev scope or PTEs are not available here.

So if you use the BC-container-helper's Publish-PerTenantExtensionApps to automate updating PTEs through a deployment pipeline, you'll soon have a history of old versions of the PTE cluttering the customer's list of installed (published) extensions: image

I guess this was the intention of the OP and it's the reason why I'm here looking :)

peterlinnet avatar Jun 27 '23 08:06 peterlinnet

Hello, did someone solve or found a way to unpublish those cluttered PTE apps?

Tedas1 avatar Oct 13 '23 08:10 Tedas1

@SBalslev - do you know how people can get rid of old PTE versions? (or do you know who knows)

freddydk avatar Oct 14 '23 11:10 freddydk

Hi, also wondering the same thing? Is it possible to unpublish PTE:s through the API? @SBalslev

kennetlindberg avatar Jan 08 '24 11:01 kennetlindberg

Hello. Has anybody found a solution for this problem?

SilMueller avatar Feb 02 '24 06:02 SilMueller

We have the same issue.

Would it make sense to enter an idea in the https://experience.dynamics.com/ideas/-Portal under development and vote for it?

MBGWS avatar Feb 13 '24 14:02 MBGWS

Here is an old existing idea that I just voted for: https://experience.dynamics.com/ideas/idea/?ideaid=c35221d7-717a-eb11-8fed-0003ff45e089

kennetlindberg avatar Feb 13 '24 18:02 kennetlindberg

I voted too - could everyone please also share the idea and vote for it?

MBGWS avatar Feb 14 '24 08:02 MBGWS

Many people have shown interest for this, if my skills in AL code would allow me, I would add this myself, but they don't :-(

I just want to mention that the source code for APIV2 is here: https://github.com/microsoft/ALAppExtensions/tree/main/Apps/W1/APIV2/app

And if you know how to write app code, you can actually add the code yourself by starting here: https://github.com/microsoft/ALAppExtensions/issues/new?assignees=&labels=bcidea&projects=&template=bcidea.yaml&title=%5BBC+Idea%5D%3A+ - specify which idea you want to implement and add the code in a PR.

It is probably a fairly small effort for a skilled app developer - but please create the issue before the PR and discuss best implementation together.

Looking forward to see a solution, which I can implement in BcContainerHelper and AL-Go for GitHub afterwards... :-)

There are several solutions to the problem - one method could be to have a function, which would unpublish all uninstalled apps - this way we can just call that method after installations - and if the installation has a schedule - it won't do anything until next time around.

freddydk avatar Jun 17 '24 10:06 freddydk