I'm sure I'm not the first hitting this problem but I haven't found any useful question/answer on StackOverflow.
I've started working in a company that proposes a SaaS solution which uses App Service and Azure SQL Database. The architecture is
a bit like this:
Naturally we have problems estimating costs at the end of the month.
My solution would be to put in place Azure Cost Management connector in Power BI but even that will not help me estimate exactly the costs of the App service per customer.
Microsoft itself suggests to Allocate costs by using resource tags but even that way isn't precise enough for me:
With this tagging strategy, it's easy to filter the cost information to a single stamp. It's also easy to find the cost of the tenant-specific resources, such as the total cost of the database for tenant C. Shared components don't have a tenant-id tag, but the cost of the shared components for a stamp can be divided between the tenants who are assigned to use that stamp or shard.
So once again Microsoft is underlining that the only way to calculate costs precisely is to go full Single-Tenant (Tenant C in the example).
Do you agree that going Single-Tenant at App and database level is the only way out?
Can you give me a few examples of how you address this problem in your company?
There is a relatively new feature called Cost Allocation that is currently in public preview. It means that it may have limited capabilities until it is fully released (see the Current limitations section in the linked documentation page).
If you are a customer with a Microsoft Customer Agreement or an Enterprise Agreement (EA), you can try enabling this feature in the Cost Management section of Azure portal and check if available cost allocation rules meet your requirements.
With cost allocation, you can reassign or distribute the costs of shared services from subscriptions, resource groups or tags to other subscriptions, resource groups or tags in your organization. You are able to create multiple "sources" and "targets" and configure the allocation percentage either manually or proportionally based on the compute cost, storage cost, or network cost.
Please note that cost allocation will not affect your billing invoice as the primary purpose of cost allocation is to help you to charge costs back to others.