HodorNV / ALOps

ALOps
59 stars 24 forks source link

ALOps Extension API fails with 403 Forbidden #519

Closed mrabus closed 2 years ago

mrabus commented 2 years ago

Describe the bug I try to publish a single app using the ALOps Extension API task. This fails with the following error: grafik

the used yaml grafik

the output Also the complete output is necessary for us to see what is going on. Also use backtics:

2022-05-25T14:36:49.1240276Z ##[section]Starting: ALOps Extension API
2022-05-25T14:36:49.1473153Z ==============================================================================
2022-05-25T14:36:49.1473446Z Task         : ALOps Extension API
2022-05-25T14:36:49.1473680Z Description  : Get/Publish extensions with the Business Central API
2022-05-25T14:36:49.1473885Z Version      : 1.449.3024
2022-05-25T14:36:49.1474029Z Author       : Hodor
2022-05-25T14:36:49.1474955Z Help         : Get/Publish extensions with the Business Central API.
2022-05-25T14:36:49.1475252Z ==============================================================================
2022-05-25T14:36:50.2235448Z *** Validate configuration
2022-05-25T14:36:50.5099643Z *** Task Inputs:
2022-05-25T14:36:50.5157961Z 
2022-05-25T14:36:50.5290909Z name                                                                                                value
2022-05-25T14:36:50.5294962Z ----                                                                                                -----
2022-05-25T14:36:50.5298020Z usedocker                                                                                           False
2022-05-25T14:36:50.5300660Z fixed_tag                                                                                                
2022-05-25T14:36:50.5303233Z interaction                                                                                       publish
2022-05-25T14:36:50.5306320Z api_endpoint                                                        http://api.CustomerXYZ.com:7088/CustomerXYZ_test/
2022-05-25T14:36:50.5309007Z apiversion                                                                                           v1.0
2022-05-25T14:36:50.5311895Z authentication                                                                                      basic
2022-05-25T14:36:50.5314815Z azure_tenant_id                                                                                          
2022-05-25T14:36:50.5317560Z azure_app_client_id                                                                                      
2022-05-25T14:36:50.5320284Z azure_app_client_secret                                                                                  
2022-05-25T14:36:50.5322822Z username                                                                                            tu_bc
2022-05-25T14:36:50.5326245Z password                                                                                     ***
2022-05-25T14:36:50.5328186Z bccompany                                                                                                
2022-05-25T14:36:50.5331167Z artifact_path                                                           C:\azp\agent\_work\r1\a\App\CustomerXYZ
2022-05-25T14:36:50.5334148Z artifact_filter         B.i.TEAM Gesellschaft für Softwareberatung mbH_CustomerXYZ Datenuebernahme_19.0.5.0.app
2022-05-25T14:36:50.5336786Z showdeploymentstatus                                                                                 True
2022-05-25T14:36:50.5339791Z checksecondsdelay                                                                                       5
2022-05-25T14:36:50.5342614Z maxtries                                                                                               10
2022-05-25T14:36:50.5343117Z 
2022-05-25T14:36:50.5369822Z 
2022-05-25T14:36:50.5377834Z 
2022-05-25T14:36:50.5544064Z *** For documentation, please visit   : https://www.alops.be/documentation
2022-05-25T14:36:50.5547326Z 
2022-05-25T14:36:50.9550851Z *** ALOps License:
2022-05-25T14:36:50.9569346Z   * Licensed To: Cosmo Consult - Azure Devops & Docker Self-Service
2022-05-25T14:36:50.9572646Z 
2022-05-25T14:36:51.6640258Z *** Imported required PS-Functions
2022-05-25T14:36:51.6655458Z *** Parse Task Parameters
2022-05-25T14:36:51.7004440Z *** Creating API Connector with endpoint [http://api.CustomerXYZ.com:7088/CustomerXYZ_test/]
2022-05-25T14:36:51.7179580Z *** API Version: v1.0
2022-05-25T14:36:51.7202860Z *** Interaction Mode: publish
2022-05-25T14:36:51.7232494Z *** API Authentication: Using Basic Authentication [tu_bc]
2022-05-25T14:36:51.7296399Z *** List Companies
2022-05-25T14:36:51.7373070Z ##[command]Invoke-RestMethod -Method Get -Uri 'http://api.CustomerXYZ.com:7088/CustomerXYZ_test/api/microsoft/automation/v1.0/companies'
2022-05-25T14:36:58.2995655Z 
2022-05-25T14:36:58.3002556Z 
2022-05-25T14:36:58.3009021Z id                : 3d47608c-5f59-ea11-91bd-005056895710
2022-05-25T14:36:58.3010391Z systemVersion     : 16.3.14238
2022-05-25T14:36:58.3012000Z name              : 10 CustomerXYZ
2022-05-25T14:36:58.3013319Z displayName       : Testdatenbank CustomerXYZ GmbH
2022-05-25T14:36:58.3013835Z businessProfileId : 
2022-05-25T14:36:58.3015083Z systemCreatedAt   : 0001-01-01T00:00:00Z
2022-05-25T14:36:58.3016153Z systemCreatedBy   : 00000000-0000-0000-0000-000000000000
2022-05-25T14:36:58.3017264Z systemModifiedAt  : 2022-01-09T18:01:06.377Z
2022-05-25T14:36:58.3018866Z systemModifiedBy  : 2bffeaac-7152-480d-ad7c-a893984c7d37
2022-05-25T14:36:58.3019441Z 
2022-05-25T14:36:58.3024920Z id                : 6997011b-2375-eb11-91cc-005056895710
2022-05-25T14:36:58.3026425Z systemVersion     : 16.3.14238
2022-05-25T14:36:58.3027300Z name              : Companyname2
2022-05-25T14:36:58.3028558Z displayName       : Companyname2
2022-05-25T14:36:58.3029076Z businessProfileId : 
2022-05-25T14:36:58.3030565Z systemCreatedAt   : 0001-01-01T00:00:00Z
2022-05-25T14:36:58.3032111Z systemCreatedBy   : 00000000-0000-0000-0000-000000000000
2022-05-25T14:36:58.3033482Z systemModifiedAt  : 2022-01-09T18:01:08.93Z
2022-05-25T14:36:58.3034987Z systemModifiedBy  : 2bffeaac-7152-480d-ad7c-a893984c7d37
2022-05-25T14:36:58.3035587Z 
2022-05-25T14:36:58.3041117Z id                : 05b5ee28-5f5e-eb11-91ca-005056895710
2022-05-25T14:36:58.3042680Z systemVersion     : 16.3.14238
2022-05-25T14:36:58.3043965Z name              : Companyname3
2022-05-25T14:36:58.3045302Z displayName       : Companyname3
2022-05-25T14:36:58.3045831Z businessProfileId : 
2022-05-25T14:36:58.3047578Z systemCreatedAt   : 0001-01-01T00:00:00Z
2022-05-25T14:36:58.3049149Z systemCreatedBy   : 00000000-0000-0000-0000-000000000000
2022-05-25T14:36:58.3050308Z systemModifiedAt  : 2022-01-09T18:01:14.077Z
2022-05-25T14:36:58.3051726Z systemModifiedBy  : 2bffeaac-7152-480d-ad7c-a893984c7d37
2022-05-25T14:36:58.3053268Z 
2022-05-25T14:36:58.3059552Z id                : 4d08d0a3-2275-eb11-91cc-005056895710
2022-05-25T14:36:58.3060657Z systemVersion     : 16.3.14238
2022-05-25T14:36:58.3061393Z name              : Companyname4
2022-05-25T14:36:58.3062726Z displayName       : Companyname4
2022-05-25T14:36:58.3063488Z businessProfileId : 
2022-05-25T14:36:58.3064753Z systemCreatedAt   : 0001-01-01T00:00:00Z
2022-05-25T14:36:58.3065345Z systemCreatedBy   : 00000000-0000-0000-0000-000000000000
2022-05-25T14:36:58.3067038Z systemModifiedAt  : 2022-01-09T18:01:30.887Z
2022-05-25T14:36:58.3068476Z systemModifiedBy  : 2bffeaac-7152-480d-ad7c-a893984c7d37
2022-05-25T14:36:58.3068689Z 
2022-05-25T14:36:58.3069350Z 
2022-05-25T14:36:58.3071044Z 
2022-05-25T14:36:58.3113497Z *** Selected Company: 10 CustomerXYZ [3d47608c-5f59-ea11-91bd-005056895710]
2022-05-25T14:36:58.3201000Z ##[command]Invoke-RestMethod -Method Get -Uri 'http://api.CustomerXYZ.com:7088/CustomerXYZ_test/api/microsoft/automation/v1.0/companies(3d47608c-5f59-ea11-91bd-005056895710)/extensions'
2022-05-25T14:37:07.8538093Z *** Installed Extensions:
2022-05-25T14:37:07.8594057Z 
2022-05-25T14:37:07.8656637Z publisher                                      displayName                           version id                        
2022-05-25T14:37:07.8663500Z ---------                                      -----------                           ------- --                        
2022-05-25T14:37:07.8683125Z B.i.TEAM Gesellschaft für Softwareberatung mbH BC_Documents                          19.0    0f30a753-891c-45f8-ae6c...
2022-05-25T14:37:07.8696889Z B.i.TEAM Gesellschaft für Softwareberatung mbH easyPDF                               19.0    f90a6281-5db4-4672-9e17...
2022-05-25T14:37:07.8713618Z B.i.TEAM Gesellschaft für Softwareberatung mbH easySUPRA                             19.0    52aa601a-409f-42dd-b807...
2022-05-25T14:37:07.8727653Z B.i.TEAM Gesellschaft für Softwareberatung mbH CustomerXYZ General                         19.0    f0387a01-4ad3-4600-9cd7...
2022-05-25T14:37:07.8743315Z B.i.TEAM Gesellschaft für Softwareberatung mbH CustomerXYZ MCS-Interface                   19.0    867d7279-1b26-44a1-9788...
2022-05-25T14:37:07.8755836Z B.i.TEAM Gesellschaft für Softwareberatung mbH CustomerXYZ OPplus Extension                19.0    e9017eeb-d60a-4999-9c9e...
2022-05-25T14:37:07.8773464Z B.i.TEAM Gesellschaft für Softwareberatung mbH CustomerXYZ Shipping Module                 19.0    57979a35-742f-46de-8d60...
2022-05-25T14:37:07.8788368Z B.i.TEAM Gesellschaft für Softwareberatung mbH VNTBC                                 19.0    2ecd17c5-17d8-4526-a859...
2022-05-25T14:37:07.8802472Z Comsol Unternehmenslösungen AG                 Travel Expenses                       19.13   50ebf609-7f57-460a-8d79...
2022-05-25T14:37:07.8816610Z gbedv GmbH & Co. KG                            OPplus 365                            19.1803 88cf5d4c-8afc-4a98-9cb7...
2022-05-25T14:37:07.8830466Z gbedv GmbH & Co. KG                            OPplus 365 - OnPrem GUID Upgrade Tool 19.1800 d0369c87-6301-46e2-a8ce...
2022-05-25T14:37:07.8845241Z Microsoft                                      Application                           19.0    c1335042-3002-4257-bf8a...
2022-05-25T14:37:07.8858988Z Microsoft                                      Base Application                      19.0    437dbf0e-84ff-417a-965d...
2022-05-25T14:37:07.8872718Z Microsoft                                      System Application                    19.0    63ca2fa4-4f03-4f2b-a480...
2022-05-25T14:37:07.8873051Z 
2022-05-25T14:37:07.8875051Z 
2022-05-25T14:37:07.8880755Z 
2022-05-25T14:37:07.8890574Z *** Published Extensions (not installed):
2022-05-25T14:37:07.8902004Z 
2022-05-25T14:37:07.8937418Z *** Import NAV/BC Management DLL's
2022-05-25T14:37:07.8960249Z *** ServiceTier not specified, loading default assemblies.
2022-05-25T14:37:07.9011799Z *** Default Assemblies not found. Load via BC-Artifacts
2022-05-25T14:37:07.9054547Z *** Install/Update BCContainerHelper [https://github.com/microsoft/navcontainerhelper]
2022-05-25T14:37:07.9101651Z *** Check BcContainerHelper
2022-05-25T14:37:07.9572166Z *** Load BcContainerHelper
2022-05-25T14:37:08.2537679Z BcContainerHelper version 3.0.1
2022-05-25T14:37:08.2621557Z BcContainerHelper emits usage statistics telemetry to Microsoft
2022-05-25T14:37:09.2734477Z 
2022-05-25T14:37:09.2735485Z ModuleType Version    Name                                ExportedCommands                                             
2022-05-25T14:37:09.2736500Z ---------- -------    ----                                ----------------                                             
2022-05-25T14:37:09.2737002Z Script     3.0.1      BcContainerHelper                   {Add-FontsToBcContainer, Add-GitToAlProjectFolder, Backup-...
2022-05-25T14:37:09.2737266Z 
2022-05-25T14:37:09.2737349Z 
2022-05-25T14:37:09.2737448Z 
2022-05-25T14:37:09.2739164Z 
2022-05-25T14:37:09.2768086Z ##[command]"Get-BCArtifactUrl" 
2022-05-25T14:37:09.2768478Z Name                           Value                                                                                   
2022-05-25T14:37:09.2768938Z ----                           -----                                                                                   
2022-05-25T14:37:09.2769383Z select                         Latest                                                                                  
2022-05-25T14:37:09.2770036Z type                           OnPrem                                                                                  
2022-05-25T14:37:09.2770402Z country                        W1                                                                                      
2022-05-25T14:37:09.2770791Z 
2022-05-25T14:37:09.2771105Z 
2022-05-25T14:37:09.2771763Z  -select: Latest -type: OnPrem -country: W1
2022-05-25T14:37:11.9897045Z Downloading application artifact /onprem/20.1.39764.39901/w1
2022-05-25T14:37:12.0049686Z Downloading C:\Users\ContainerAdministrator\AppData\Local\Temp\5d935ada-3ba6-4ae8-b424-4828a22e8a92.zip
2022-05-25T14:37:14.5348616Z Unpacking application artifact to tmp folder using 7zip
2022-05-25T14:37:16.5601871Z Downloading platform artifact /onprem/20.1.39764.39901/platform
2022-05-25T14:37:16.5628909Z Downloading C:\Users\ContainerAdministrator\AppData\Local\Temp\d6d83468-b682-4cf6-95d1-861718d506a4.zip
2022-05-25T14:37:26.4667944Z Unpacking platform artifact to tmp folder using 7zip
2022-05-25T14:37:39.4825098Z Downloading Prerequisite Components
2022-05-25T14:37:39.4922410Z Downloading C:\bcartifacts.cache\onprem\20.1.39764.39901\platform\Prerequisite Components\DotNetCore\DotNetCore.1.0.4_1.1.1-WindowsHosting.exe
2022-05-25T14:37:40.8932611Z Downloading C:\bcartifacts.cache\onprem\20.1.39764.39901\platform\Prerequisite Components\Open XML SDK 2.5 for Microsoft Office\OpenXMLSDKv25.msi
2022-05-25T14:37:41.0092189Z Downloading C:\bcartifacts.cache\onprem\20.1.39764.39901\platform\Prerequisite Components\IIS URL Rewrite Module\rewrite_2.0_rtw_x64.msi
2022-05-25T14:37:41.8378992Z *** Platform: C:\bcartifacts.cache\onprem\20.1.39764.39901\platform
2022-05-25T14:37:41.8404355Z *** Localisation: C:\bcartifacts.cache\onprem\20.1.39764.39901\w1
2022-05-25T14:37:41.8719340Z *** BC Management DLL: C:\bcartifacts.cache\onprem\20.1.39764.39901\platform\ServiceTier\program files\Microsoft Dynamics NAV\200\Service\Microsoft.Dynamics.Nav.Management.dll
2022-05-25T14:37:42.4379905Z *** BC App Management DLL: C:\bcartifacts.cache\onprem\20.1.39764.39901\platform\ServiceTier\program files\Microsoft Dynamics NAV\200\Service\Microsoft.Dynamics.Nav.Apps.Management.dll
2022-05-25T14:37:42.4876900Z *** Publish Extension
2022-05-25T14:37:42.4885316Z   * Artifact Path  : C:\azp\agent\_work\r1\a\App\CustomerXYZ
2022-05-25T14:37:42.4893646Z   * Artifact Filter: B.i.TEAM Gesellschaft für Softwareberatung mbH_CustomerXYZ Datenuebernahme_19.0.5.0.app
2022-05-25T14:37:42.5011331Z *** Resolve App file in [C:\azp\agent\_work\r1\a\App\CustomerXYZ]
2022-05-25T14:37:42.5064025Z *** Multiple App files found with filter [B.i.TEAM Gesellschaft für Softwareberatung mbH_CustomerXYZ Datenuebernahme_19.0.5.0.app].
2022-05-25T14:37:42.5085526Z   * C:\azp\agent\_work\r1\a\App\CustomerXYZ\B.i.TEAM Gesellschaft für Softwareberatung mbH_CustomerXYZ Datenuebernahme_19.0.5.0.app
2022-05-25T14:37:42.5095919Z *** Resolved App File: [C:\azp\agent\_work\r1\a\App\CustomerXYZ\B.i.TEAM Gesellschaft für Softwareberatung mbH_CustomerXYZ Datenuebernahme_19.0.5.0.app].
2022-05-25T14:37:42.5115919Z *** Resolved App Path: [C:\azp\agent\_work\r1\a\App\CustomerXYZ\B.i.TEAM Gesellschaft für Softwareberatung mbH_CustomerXYZ Datenuebernahme_19.0.5.0.app]
2022-05-25T14:37:42.5206218Z *** Upload extension [C:\azp\agent\_work\r1\a\App\CustomerXYZ\B.i.TEAM Gesellschaft für Softwareberatung mbH_CustomerXYZ Datenuebernahme_19.0.5.0.app]
2022-05-25T14:37:42.5218477Z *** Get App Info
2022-05-25T14:37:42.8692440Z  * App.ID        = 2c1890be-707c-45d2-97a8-98e6fe6f456e
2022-05-25T14:37:42.8719567Z  * App.Name      = CustomerXYZ Datenuebernahme
2022-05-25T14:37:42.8743396Z  * App.Publisher = B.i.TEAM Gesellschaft für Softwareberatung mbH
2022-05-25T14:37:42.8768392Z  * App.Version   = 19.0.5.0
2022-05-25T14:37:42.8779347Z *** Get Extension status
2022-05-25T14:37:42.8790522Z ##[command]Invoke-RestMethod -Method Get -Uri 'http://api.CustomerXYZ.com:7088/CustomerXYZ_test/api/microsoft/automation/v1.0/companies(3d47608c-5f59-ea11-91bd-005056895710)/extensions'
2022-05-25T14:37:42.9914500Z ##[command]Invoke-RestMethod -Method Patch -Uri 'http://api.CustomerXYZ.com:7088/ehret_test/api/microsoft/automation/v1.0/companies(3d47608c-5f59-ea11-91bd-005056895710)/extensionUpload(0)/content'
2022-05-25T14:37:43.3688249Z ##[error]<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access this resource.</p>
</body></html>

2022-05-25T14:37:43.3996099Z ##[section]Finishing: ALOps Extension API

Expected behavior Best case, the app is published without issues. Otherwise any hint what is going wrong would be awesome.

Additional context I tried to check some issues. The automation API is reachable from the internet, otherwise the queries for the companies and the installed apps would fail, too. The user has SUPER, D365 AUTOMATION and Exten. MGT. - ADMIN permissions, so that should be okay.

The installation of the external deployer is okay as well. I was able to publish the app through the page 2507 before without issues.

Any help would be much appreciated

waldo1001 commented 2 years ago

It seems to be a webservice (IIS? - redirected?) that is intervening .. .
Could it be some kind of firewall that prevents some kind of PATCH method? Or the command is blocked on iis? Or anything that's in between?

It does NOT seem to be a BC problem - as it's not a BC error message.. . I'd look into the infrastructure.

ALOps prints the method and the url - you should be able to test that in e.g. postman.. .

waldo1001 commented 2 years ago

Were you able to test it?

waldo1001 commented 2 years ago

@mrabus ?

waldo1001 commented 2 years ago

I'm closing this issue. If you feel the need to reopen it, please feel free to do so.

NAVFreak commented 1 year ago

I had the same issue and the problem disappeared when the customers IT-guys loosen up the firewall/redirection rules