Skip to content

Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (403) Forbidden." #443

@amitmurli

Description

@amitmurli

Hi,
We are running the Sitecore Unicorn Sync in our Build pipeline line which was working fine but It started failing when we have upgraded AKS version to 1.31.5 for Sitecore Containers in Azure and we are using Sitecore 10.3.1.
We started getting below error in our pipeline.

Sync-Unicorn: E:\builds\0\docker\devops\scripts\Unicorn\Trigger-Unicorn-Sync.ps1:20
Line |
20 | Sync-Unicorn -ControlPanelUrl $syncUnicornUrl -SharedSecret $deployme …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (403) Forbidden."
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit status 1

We have used MicroCHAP.dll and Unicorn.psm1 to trigger the unicorn sync using the below script.

$url = $args[0]
$deploymentToolAuthToken = $args[1]
 
if ($url.length -eq 0 -OR $deploymentToolAuthToken.length -eq 0) {
write-error "ERROR - missing url or deployment token."
}
else
{
$ErrorActionPreference = 'Stop'
 
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path
 
# This is an example PowerShell script that will remotely execute a Unicorn sync using the new CHAP authentication system.
 
Import-Module $ScriptPath\Unicorn.psm1 -Force

$syncUnicornUrl = $url + "/unicorn.aspx";

# SYNC
Sync-Unicorn -ControlPanelUrl $syncUnicornUrl -SharedSecret $deploymentToolAuthToken -Configurations @('XXXX', 'XXXXX', 'XXXXXX', 'XXXXXXX', 'XXXXXXXX') -StreamLogs
 
}

I have confirmed all the below things as well.
1- SharedSecret are same in the script and in CM server config
2- MicroCHAP.dll library version is also same in CM server.
3-Set WriteAuthFailuresToLog to true in Unicorn config to check received and expected Mac but it is still not being logged.
true</WriteAuthFailuresToLog
4- Restarted Containers
5- Executed the script from my local machine and getting the same error.
6- I have tried the uniron sync manually browsing the Unicron.aspx and it is working fine.

Could you please help me to investigate and resolve this issue?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions