Cloud Migration Replication fails with '401 - Client request has not been completed'

Daniel Gorski
CEO
3 Min. Lesezeit

If you get the following error by using a delegated admin user on the customer's tenant:
"Client request has not been completed because it lacks valid authentication credentials for the requested endpoint(url)."
You should read this post.
What's happening? Read the general process or phases you go through to migrate data from on-premises to online here:
👉 Business Central on-premises to online migration - End-to-end overview
I've been using: IntegrationRuntime_5.41.8909.1
- SQL credentials are valid and tested
- Connection string works fine
Your SQL connection string should look like:
Server=<server>;Initial Catalog=<database>;User Id=<user>;Password=<pw>;
Use a SQL Server user, ideally sa
or a dedicated migration account.
To test it with PowerShell:
$connection = New-Object System.Data.SqlClient.SqlConnection
$connection.ConnectionString = "Server=<server>;Initial Catalog=<database>;User Id=<user>;Password=<pw>;"
$connection.Open()
$connection.Close()
More troubleshooting info here:
👉 Troubleshooting the Cloud Migration - Microsoft Learn
✅ Solution
It does not work with an delegated admin account - even if that account got granted consent for cloud migration through page 40027.
I had to create a user on the customers tenant and assign a full bc user license - in that case a business central premium license.
It worked like a charm after repeating the cloud migration and using the new user.
Here is the full call stack:
Full Error Stack
Error message: Failed to prepare the systems for replication.
The call to prepare servers failed.
Run id='2fa85fef-be00-49a4-a0f8-f8dcb7528269',
Name='msweua1602t64662185_BCLast_Preparation',
ErrorMessage='Operation on target NotifyBusinessCentral failed: Invoking endpoint failed with HttpStatusCode - '401 : Unauthorized',
message - 'Client request has not been completed because it lacks valid authentication credentials for the requested endpoint(url).'
Internal session ID: 018d1a25-89fc-4eda-a3d7-39db1f87035a
Application Insights session ID: bcabf06c-fae8-44ae-8590-7a71a3fd31e2
Client activity id: 79fb8a43-141e-4b5e-aba5-1bcb3372ee80
Time stamp on error: 2024-06-05T18:09:35.5583917Z
User telemetry id: 7ce5c218-ad2f-48a1-9b58-7e5bc0d5f1c1
AL Call Stack
"Hybrid Deployment"(CodeUnit 6060).RetryGetStatus line 22 - Base Application by Microsoft
"Hybrid Deployment"(CodeUnit 6060).RetryGetStatus line 2 - Base Application by Microsoft
"Hybrid Deployment"(CodeUnit 6060).EnableReplication line 23 - Base Application by Microsoft
"Hybrid Cloud Management"(CodeUnit 4001).EnableReplication line 8 - Intelligent Cloud Base by Microsoft
"Hybrid Cloud Management"(CodeUnit 4001).HandleShowCompanySelectionStep line 8 - Intelligent Cloud Base by Microsoft
"Hybrid Cloud Setup Wizard"(Page 4000).ShowCompanySelectionStep line 5 - Intelligent Cloud Base by Microsoft
"Hybrid Cloud Setup Wizard"(Page 4000).NextStep line 40 - Intelligent Cloud Base by Microsoft
"Hybrid Cloud Setup Wizard"(Page 4000).NextStep line 30 - Intelligent Cloud Base by Microsoft
"Hybrid Cloud Setup Wizard"(Page 4000)."ActionNext - OnAction"(Trigger) line 35 - Intelligent Cloud Base by Microsoft