microsoft / coe-starter-kit

Other
752 stars 225 forks source link

[ALM Accelerator - BUG]: Error during Import Managed Solution as Update #3488

Closed megel closed 1 year ago

megel commented 2 years ago

Describe the issue

image
2022-08-20T10:47:01.9094335Z ##[section]Starting: Import Managed Solution as Update
2022-08-20T10:47:01.9229326Z ==============================================================================
2022-08-20T10:47:01.9229635Z Task         : Power Platform Import Solution
2022-08-20T10:47:01.9229882Z Description  : Power Platform Import Solution
2022-08-20T10:47:01.9230082Z Version      : 2.0.4
2022-08-20T10:47:01.9230259Z Author       : Microsoft
2022-08-20T10:47:01.9230477Z Help         : [More Info](https://aka.ms/buildtoolsdoc)
2022-08-20T10:47:01.9230765Z ==============================================================================
2022-08-20T10:47:02.1676252Z Discovered environment url from explicit input parameter 'Environment': https://orgf68b9db6.crm4.dynamics.com/
2022-08-20T10:47:02.1714360Z [ 'authN to env: authType=SPN; cloudInstance: Public; envUrl: https://orgf68b9db6.crm4.dynamics.com/' ]
2022-08-20T10:47:03.8588222Z [ '\'***\' authenticated successfully.' ]
2022-08-20T10:47:03.8621398Z [ 'Validating connection...' ]
2022-08-20T10:47:04.5549651Z [ 'Connected to...Unable to validate connection to default environment' ]
2022-08-20T10:47:04.5813592Z [ 'Authentication profile created' ]
2022-08-20T10:47:04.5846186Z [ '    * DATAVERSE                                https://orgf68b9db6.crm4.dynamics.com/   : ***     Public' ]
2022-08-20T10:47:04.5846601Z [ '' ]
2022-08-20T10:47:04.7700061Z [ 'The Authentication Result: \'***\' authenticated successfully.,Validating connection...,Connected to...Unable to validate connection to default environment,Authentication profile created,    * DATAVERSE                                https://orgf68b9db6.crm4.dynamics.com/   : ***     Public,' ]
2022-08-20T10:47:04.7727300Z [ 'Calling pac cli inputs: solution import --path D:\\a\\1\\drop\\cosmo_time_1.0.20220820.1_managed.zip --async true --import-as-holding false --force-overwrite true --publish-changes false --skip-dependency-check false --convert-to-managed false --max-async-wait-time 60 --activate-plugins true --settings-file D:\\a\\1\\drop\\deploymentSettings.json' ]
2022-08-20T10:47:06.4982070Z [ 'Connected to...Microsoft PowerPlatform CLI' ]
2022-08-20T10:47:06.4985184Z [ 'Version: 1.17.5+gcbb58e8' ]
2022-08-20T10:47:06.4985793Z [ '' ]
2022-08-20T10:47:06.4994833Z [ 'Error: Failed to connect to Dataverse' ]
2022-08-20T10:47:06.4995480Z [ '    Failed to connect to Dataverse' ]
2022-08-20T10:47:06.4996003Z [ '        One or more errors occurred.' ]
2022-08-20T10:47:06.4996884Z [ '            Exception - Fault While initializing client - RefreshInstanceDetails' ]
2022-08-20T10:47:06.4997618Z [ '                Exception - Failed to lookup current organization data' ]
2022-08-20T10:47:06.4998410Z [ '                    The HTTP request was forbidden with client authentication scheme \'Anonymous\'.' ]
2022-08-20T10:47:06.4999172Z [ '                        The remote server returned an error: (403) Forbidden.' ]
2022-08-20T10:47:06.4999688Z [ '' ]
2022-08-20T10:47:06.5000029Z [ '' ]
2022-08-20T10:47:06.5000972Z [ 'Usage: pac solution import [--path] [--activate-plugins] [--force-overwrite] [--skip-dependency-check] [--import-as-holding] [--publish-changes] [--convert-to-managed] [--async] [--max-async-wait-time] [--settings-file]' ]
2022-08-20T10:47:06.5001901Z [ '' ]
2022-08-20T10:47:06.5002575Z [ '  --path                      Path to solution zip file. If not specified, assumes the current folder is a cdsproj project. (alias: -p)' ]
2022-08-20T10:47:06.5003493Z [ '  --activate-plugins          Activate plug-ins and workflows on the solution (alias: -ap)' ]
2022-08-20T10:47:06.5004288Z [ '  --force-overwrite           Force an overwrite of unmanaged customizations (alias: -f)' ]
2022-08-20T10:47:06.5005150Z [ '  --skip-dependency-check     Skip dependency check against dependencies flagged as product update (alias: -s)' ]
2022-08-20T10:47:06.5006030Z [ '  --import-as-holding         Import the solution as a holding solution (alias: -h)' ]
2022-08-20T10:47:06.5006521Z [ '  --publish-changes           Publish your changes upon a successful import (alias: -pc)' ]
2022-08-20T10:47:06.5008536Z [ '  --convert-to-managed        Convert as Managed Solution (alias: -cm)' ]
2022-08-20T10:47:06.5008944Z [ '  --async                     Imports solution asynchronously (alias: -a)' ]
2022-08-20T10:47:06.5009415Z [ '  --max-async-wait-time       Max asynchronous wait time in minutes. Default value is 60 minutes (alias: -wt)' ]
2022-08-20T10:47:06.5009992Z [ '  --settings-file             The .json file with the deployment settings for connection references and environment variables.' ]
2022-08-20T10:47:06.5010379Z [ '' ]
2022-08-20T10:47:06.6636196Z ##[error]error: 1
2022-08-20T10:47:06.6656895Z ##[error]failed: Connected to...Microsoft PowerPlatform CLI
Version: 1.17.5+gcbb58e8

Error: Failed to connect to Dataverse
    Failed to connect to Dataverse
        One or more errors occurred.
            Exception - Fault While initializing client - RefreshInstanceDetails
                Exception - Failed to lookup current organization data
                    The HTTP request was forbidden with client authentication scheme 'Anonymous'.
                        The remote server returned an error: (403) Forbidden.

Usage: pac solution import [--path] [--activate-plugins] [--force-overwrite] [--skip-dependency-check] [--import-as-holding] [--publish-changes] [--convert-to-managed] [--async] [--max-async-wait-time] [--settings-file]

  --path                      Path to solution zip file. If not specified, assumes the current folder is a cdsproj project. (alias: -p)
  --activate-plugins          Activate plug-ins and workflows on the solution (alias: -ap)
  --force-overwrite           Force an overwrite of unmanaged customizations (alias: -f)
  --skip-dependency-check     Skip dependency check against dependencies flagged as product update (alias: -s)
  --import-as-holding         Import the solution as a holding solution (alias: -h)
  --publish-changes           Publish your changes upon a successful import (alias: -pc)
  --convert-to-managed        Convert as Managed Solution (alias: -cm)
  --async                     Imports solution asynchronously (alias: -a)
  --max-async-wait-time       Max asynchronous wait time in minutes. Default value is 60 minutes (alias: -wt)
  --settings-file             The .json file with the deployment settings for connection references and environment variables.

2022-08-20T10:47:07.5075625Z [ 'Authentication profiles and token cache removed' ]
2022-08-20T10:47:07.6669179Z [ 'The Clear Authentication Result: Authentication profiles and token cache removed' ]
2022-08-20T10:47:07.6683925Z ##[error]Error: Connected to...Microsoft PowerPlatform CLI
Version: 1.17.5+gcbb58e8

Error: Failed to connect to Dataverse
    Failed to connect to Dataverse
        One or more errors occurred.
            Exception - Fault While initializing client - RefreshInstanceDetails
                Exception - Failed to lookup current organization data
                    The HTTP request was forbidden with client authentication scheme 'Anonymous'.
                        The remote server returned an error: (403) Forbidden.

Usage: pac solution import [--path] [--activate-plugins] [--force-overwrite] [--skip-dependency-check] [--import-as-holding] [--publish-changes] [--convert-to-managed] [--async] [--max-async-wait-time] [--settings-file]

  --path                      Path to solution zip file. If not specified, assumes the current folder is a cdsproj project. (alias: -p)
  --activate-plugins          Activate plug-ins and workflows on the solution (alias: -ap)
  --force-overwrite           Force an overwrite of unmanaged customizations (alias: -f)
  --skip-dependency-check     Skip dependency check against dependencies flagged as product update (alias: -s)
  --import-as-holding         Import the solution as a holding solution (alias: -h)
  --publish-changes           Publish your changes upon a successful import (alias: -pc)
  --convert-to-managed        Convert as Managed Solution (alias: -cm)
  --async                     Imports solution asynchronously (alias: -a)
  --max-async-wait-time       Max asynchronous wait time in minutes. Default value is 60 minutes (alias: -wt)
  --settings-file             The .json file with the deployment settings for connection references and environment variables.

2022-08-20T10:47:07.6783022Z ##[section]Finishing: Import Managed Solution as Update

Expected Behavior

No response

What component are you experiencing the issue with?

ALM Accelerator Pipelines

What solution version are you using?

August 2022

Steps To Reproduce

No response

Anything else?

No response

AB#1209

devkeydet commented 2 years ago

Nothing that I see suggests that this is an issue with the accelerator as much as an issue with the platform and or task. Unless there are more details I am missing, there's not much we can do in the accelerator to address this. If there are more details you can provide that lead you to believe this is an accelerator issue, not a platform/task issue, please do let us know. We just call the Power Platform Build Tools tasks. The repo for those tasks is here: https://github.com/microsoft/powerplatform-build-tools

However, they might end up telling you they simply call the Dataverse API and your best bet really is to contact support. To try to save you from jumping around, if there aren't more details you can give us to narrow down to an actual Accelerator issue or that it's an issue in the actual Build Tools task, I would suggest going here: https://admin.powerplatform.microsoft.com/support ...and using these options: image

HTH

mikefactorial commented 2 years ago

+1 to @devkeydet comment. The only thing I can think of, based on the error, is it's a permissions issue with the App User in the development environment.

dylanhaskins commented 2 years ago

@mikefactorial @devkeydet I just had the same thing with the Publish Customisations task on the Dev environment using the latest release of the kit.

My expectation is that the maker add function on the coe-cli should add the ALMAcceleratorServicePrincipal and permissions to the maker dev environment, is that expectation correct ?

As it doesn't, not did it give any error. Manually adding the S2S user and assigning it Sys admin role solves the issue and PAC CLI can connect and publish (and presumably export in this issues instance)

Reinhard-S commented 2 years ago

Hi @mikefactorial and @devkeydet,

I am facing the same issue, the application user was not created on the target environment. Could you please also set checkbox "Grant access permission to all pipelines" within the newly created Service Connection when using commands "coe alm maker add" and "coe alm install"?

Thank you!

mikefactorial commented 2 years ago

@dylanhaskins and @Reinhard-S thanks for the feedback will investigate this and see what we can do to clean it up.

mikefactorial commented 1 year ago

Closing this out as this will be handled in the Admin app in an upcoming release. We are de-investing in the CLI in favor or the admin app for setup and maintenance in the ALM Accelerator going forward.

mikefactorial commented 1 year ago

@jenschristianschroder who is working on the ALM Accelerator Admin app features for visibility.