How to set Azure webapp default document to sub directory endpoint

Kevin Petteys 111 Reputation points
2022-12-18T01:37:12.173+00:00

I deployed a webapi to an Azure webapp. I would like the default document to be the Swagger Index.html. From AzureCLI I updated the default document

az webapp update -g [resourceGroup] -n [appname] --add siteConfig.defaultDocuments swagger\index.html

and verified it was updated from in the portat but az webapp show indicates the defaultDocuments value is null.

Any ideas on how to set the default document and why there is a difference from the portal and Azure Cli?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,986 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 25,111 Reputation points Microsoft Employee Moderator
    2022-12-19T09:55:29.693+00:00

    @Anonymous Thank for reaching out to Microsoft Q&A, apologize for the inconvenience caused on this.

    To reproduce this behavior, I have created a sample webapp (running with .NET 6 as runtime on windows app service plan) using the cmdlet az webapp update cmdlet we have set the default document to swagger/index.html and using the below cmdlet

    We can see the current default document is set to swagger/index.html only as shown below

    az webapp show -g <resourcegroupname> -n <webappname> --query siteConfig.defaultDocuments

    272031-image.png

    Also, when we route to the default URL of the web app, we can see the content of index.html in the browser as well.

    272051-image.png

    As mentioned in this documentation if your app uses modules that route based on URL instead of serving static content then there is no need for setting the default documents.

    Feel free to reach back to me if you have any further queries on this.


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.