To benefit the community; Sharing our offline discussion (cost optimization).
Firstly, to provide some background on App Service charges - At a basic level, App Service apps are charged by the App Service Plan (ASP) that hosts them.
The costs associated with your App Service deployment depend on a few main factors:
Pricing tier SKUs ( S0/1/2/3/4). As you’re aware, higher tiers provide more CPU cores, memory, storage, or features, or combinations of them.
Instance count dedicated tiers (Basic and above) can be scaled out, and each scaled out instance accrues costs.
As far as tackling the App Service Plan scale-out (horizontal scaling), the recommended approach would be to leverage the Auto scale built-in feature.
Autoscale helps applications perform at their best when demand changes. You can configure custom Autoscale policy that scales based on metric(s) thresholds, or schedule instance count which scales during designated time windows.
Autoscale enables your resource to be performant and cost-effective by adding and removing instances based on demand.
The example you highlighted is very much possible with Autoscaling.
With autoscale, you can configure rules that monitor the App Service plan metrics. Rules can increase or decrease the instance count, which can provide additional resources as needed.
These Rules also help you save money when the app is over-provisioned.
See - Get started with Autoscale in Azure
Cost Optimization techniques:
With Cost Analysis, you can fetch drill-down cost info by App Service | Resource, Service tier (screenshot below).
Based on your requirement, you could also leverage other feature for further cost optimization - ‘cost alerts’ , ‘budgets’, export, etc.
-You can also download the usage for any stipulated period.
Please see these docs:
Plan and manage costs for Azure App Service
Quickstart: Explore and analyze costs with cost analysis
I see there is no direct way to fetch consolidated info for all ASPs. You may leverage Azure Cost Management APIs – it provides the ability to explore cost and usage data.