Hi @Martin,
Empirically, this issue is not related to Azure Web App or asp.net Core.
If you're using a database in a VM, make sure you can access it in VS2022 by ip or domain name, not 127.0.0.1 or localhost. Then following the steps below to get the correct connectionstring.
If you are using azure database, please make sure you have enabled the firewall rules, and get the connectionstring as above.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Jason