How to Deploy my Code to App Service through Git Bash or Visual Studio Community 2022?

Simba Bryn Mahaja 60 Reputation points
2025-02-17T15:56:51.69+00:00

While on the Deploy your code to App Service (Exercise) exercise, I am having trouble deploying code to my Web app on Microsoft Azure, which is currently running and waiting for content. Although the Web app was created on the Azure Portal and cloned a Git URL through Visual Studio 2022 for a Git Bash deployment, I am still having trouble deploying code. Where exactly might I be misunderstanding? Can you assist?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,484 questions
GitHub Training
GitHub Training
GitHub: A web-based hosting service for software development and version control using Git. Acquired by Microsoft in 2018.Training: Instruction to develop new skills.
48 questions
{count} votes

Accepted answer
  1. Kantamsetti Aslesha 160 Reputation points Microsoft External Staff
    2025-03-10T07:57:14.55+00:00

    Hi @Simba Bryn Mahaja

    You do not have permission to view this directory or page this error usually happens when:

    Your web app is pointing to the wrong directory.

    I use below commands to successfully deploy my Web app using Azure Cli.

    1. Run the following command to generate the required files for publishing:
      dotnet publish -c Release -o <output-folder> 2025-03-10 12_37_14-WebApplication1 - Microsoft Visual Studio
    2. Log in to your Azure account by running: az login
    3. Before deploying, zip the <output-folder> generated in step 1.
    4. Deploy the zipped file to Azure using the following command:

    az webapp deploy --resource-group <ResourceGroupName> --name <WebAppName> --src-path <ZipPath>

    2025-03-10 13_31_33-WebApplication1 - Microsoft Visual Studio

    After running the above command, your app will be successfully deployed to Azure.

    Check the Kudu Console for where your files are deployed in Azure App service using below URL:

    https://<WebAppName>.scm.canadacentral-01.azurewebsites.net/DebugConsole

    In my case my files are under site -> wwwroot -> publish:

    2025-03-10 13_12_07-Diagnostic Console and 15 more pages - Work - Microsoft​ Edge

    I changed the virtual path from site\wwwroot to site\wwwroot\publish by navigating to:

    Azure Web App -> Configuration -> path Mapping -> Virtual Path -> Edit - > Ok -> save:

    2025-03-10 12_49_47-Settings

    2025-03-10 12_50_27-kacliapp - Microsoft Azure and 13 more pages - Work - Microsoft​ Edge

    2025-03-10 12_50_45-Settings

    By following above steps, It Avoid you don't have permission error.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.