"HTTP Error 401.0 - Unauthorized" problem of Azure Custom Domain

Rice Rao 1 Reputation point
2023-09-12T16:46:51.46+00:00

I have an Azure App Service (built with Asp.net MVC and Angular framework) with default domain "mywebservice.azurewebsites.net". It works well. I can visit "https://mywebservice.azurewebsites.net" and run all the functions without any issue.

I created a custom domain "mywebservice.mycompany.com" for the same app service successfully from Azure Portal. I can visit "https://mywebservice.mycompany.com" and run most of the functions there. However, several functions that require file upload (from local computer to Azure server) did not work. They always failed and reported "HTTP Error 401.0 - Unauthorized" error

I did some research but was not able to find a solution. Any helps will be appreciated. Thanks.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,408 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Konstantinos Passadis 17,456 Reputation points MVP
    2023-09-16T22:18:15.4466667+00:00

    Hello @Rice Rao !

    In case you want to upload files directly ( outside the Application)

    The Azure Web App Service has a specific FTP Configuration :

    https://learn.microsoft.com/en-us/azure/app-service/deploy-ftp?tabs=portal

    If you want to upload within your APP be aware :

    Azure Web Apps are more suitable for quick running APIs / responses. When trying to do file transfers that run more than ~30 seconds, the risk of failure is significantly high.

    In order to minimize risk of disconnect errors, a better way to upload large files would be using a SAS Key. An Azure Web App generates a storage blob's SAS Key with write access. This SAS Key can then be sent by the Web App to a browser and the browser will be used to upload the file directly into Azure Storage without involving the Web App in the upload path.

    There was a sample blog post for this published on Microsoft's techcommunity site, which I am linking here for reference: https://techcommunity.microsoft.com/t5/apps-on-azure/azure-storage-blob-upload-from-browser/ba-p/392687

    Reference : https://learn.microsoft.com/en-us/answers/questions/204060/how-to-upload-large-files-to-azure-web-apps-withou


    I hope this helps !

    Kindly mark the Answer as Accepted and Upvote , or post your feedback to provide additional help !

    Regards!

    0 comments No comments