@Pavan Naga To configure the ports for your custom container in Azure App Service, you can set the WEBSITES_PORT
app setting in your App Service app. By default, App Service assumes your custom container is listening on port 80. If your container listens to a different port, you can set the WEBSITES_PORT
app setting to the port number that your container is listening on.
For example, if you want to map port 80 to port 8501 for your Streamlit app and port 8081 to port 5000 for your Flask API, you can set the WEBSITES_PORT
app setting to 8501
for your Streamlit app and 5000
for your Flask API.
You can set the WEBSITES_PORT
app setting via the Azure Cloud Shell. In Bash:
<span class=" active-doc-0 active-doc-2" data-doc-items="0,2">az webapp config appsettings set --resource-group <group-name> --name <app-name> --settings WEBSITES_PORT=8501<a href="#doc-pos=0" data-tag-index="1"></a><a href="#doc-pos=2" data-tag-index="2"></a></span>
<pre data-lang=""><code>
In PowerShell:
```azurepowershell-interactive
<span class=" active-doc-0" data-doc-items="0">Set-AzWebApp -ResourceGroupName <group-name> -Name <app-name> -AppSettings @{"WEBSITES_PORT"="8501<a href="#doc-pos=0" data-tag-index="1"></a></span>"}
</code></pre>
<span class=" active-doc-0" data-doc-items="0">You can also set the `WEBSITES_PORT` app setting in the Azure portal<a href="#doc-pos=0" data-tag-index="1"></a></span>. To do this, go to your App Service app in the Azure portal, click on "Configuration" under "Settings", and add a new application setting with the name `WEBSITES_PORT` and the value `8501` for your Streamlit app and `5000` for your Flask API.
Once you have set the `WEBSITES_PORT` app setting for your App Service app, Azure App Service will route incoming traffic on port 80 to port 8501 for your Streamlit app and incoming traffic on port 8081 to port 5000 for your Flask API.