This article is part three of a five-part series created for Azure Spring Clean 2023 exploring tips for controlling costs of AI / ML services on Microsoft Azure.
Let's explore the costs you incur for deploying an Azure Bot Service and see what steps you can take to reduce, monitor, and control these costs over time.
If you're not familiar with Azure Bot Services, they are essentially integration points that let you connect your chatbot to multiple interaction channels so your same bot can serve users via their preferred app or channel.
Azure Bot Services isn't like that. Instead, costs tend to come from a very limited number of areas:
- Azure Bot Service Registration
- Azure App Service
- Supporting Services such as storage, security center, and Azure Cognitive Services
In this article we'll explore each of those areas in detail and look at ideas for managing and controlling your costs.
Before we go any further, I should get a legal disclaimer out of the way: This article is based on my current understanding of Azure pricing, particularly in the North American regions. It is possible the information I provide is incorrect, not relevant to your region, or outdated by the time you read this. While I make every effort to provide accurate information, I provide no guarantee or assume no liability for any costs you incur. I strongly encourage you to read Microsoft's official pricing information before making pricing decisions.
Let's get into Bot Services.
Azure Bot Service follows a fairly simple pricing structure: The service itself is free unless you require premium channels or a higher service level agreement (SLA).
Premium channels don't have a lot of documentation around them at the moment but appear to be a way of customizing the DirectLine and Web Chat clients, which the documentation describes in a little detail.
Once you enable the premium tier of bot service, you start paying $0.50 USD per one thousand messages sent to the bot.
This pricing is fairly consistent with other AI-as-a-Service offerings in Azure Cognitive Services, however this will likely not be your primary expense hosting an Azure Bot Service.
The Azure Bot Service entry serves as a registration for your app that allows it to integrate into multiple channels. The Azure Bot Service is not your actual application. When you deploy a Bot Service, you typically deploy it as an Azure App Service and then configure the Azure Bot Service to point to the Azure App Service via a URL and some additional authentication steps.
Additional Learning: Setting up a functioning bot can be tricky. Check out my tutorial on creating and deploying an Azure Bot Service and Azure App Service with Microsoft Bot Framework for more details on this process.
When you deploy your bot to an Azure App Service, you also incur the standard costs associated with an Azure App Service. These costs can include:
- The App Service Plan
- Load balancers if you scale your application horizontally
- Storage for logs or other app data
- Security center fees for the application
- Other costs depending on other Azure services used
Let's go over a few of these areas.
First, the app service plan: when you deploy a new bot from Bot Framework Composer or Microsoft Bot Framework the default behavior is to create a production-level app service plan on the Windows operating system.
This is fine if your bot is immediately going live and having many users interact with it at once. However, most bots I've seen need testing and customization during the development process, and a production-level app service is usually 10 times more expensive than you need. Additionally, while the Windows app services tend to have additional features and are the more recommended approach overall for production applications, the Linux app services are typically cheaper.
As a result, whenever I deploy a new bot for low-end use cases or development I make sure to deploy it to a Linux app service and then scale down the tier of the app service to something that meets my needs and cost preferences during development.
One of the hidden costs I've paid for significantly over time with App Services has been the $15 per month Security Center fee you pay for each App Service you deploy.
I do not recommend disabling this service, but you should be aware that you will be charged for the usage of Security Center for the app service that is created.
You can view your security center settings and tweak costs by going to Microsoft Defender for Cloud and then selecting Environment Settings and clicking into your plan.
Once there you can view and configure security settings at a granular level.
Again, I don't recommend disabling security center, but you should be aware that it is a factor in your app's pricing.
In order for your chatbot to accomplish its tasks, it may rely on other services such as Storage, App Insights, OpenAI, or Azure Cognitive Services.
Azure Cognitive Services is a very normal thing for a chatbot to need, but the scope of managing pricing on Azure Cognitive Services is so large that I wrote a separate article on Cost Management with Azure Cognitive Services.
Storage on Azure is generally fairly cheap (particularly if you are using the cool or archive tiers for infrequently accessed data), though each storage account does incur the $15 / month security center fee. That said, I do recommend investigating the Azure Storage pricing documentation for more details.
Finally, if your chatbot uses services from OpenAI such as ChatGPT, it stands to reason that your application will encounter fees from this as well. This is also outside the scope of this article, though I will be writing a separate article on OpenAI pricing on Azure.
Overall, pricing for bots on Azure is fairly straightforward, but there are a few hidden costs around app services, security center, and storage you should be aware of when planning your environments.
As with anything involving pricing in Azure, I strongly recommend that you take advantage of the pricing calculator, cost analysis, alerts, and budget features to gain additional visibility and control over your applications.
Finally, although I try to help, the reality is that my knowledge is not perfect and information can go out of date quickly. I do not assume any liability or responsibility for the advice I offer here, this is simply me sharing wisdom from my own experiences running chatbots.
Stay tuned for more content in this series as I get into OpenAI and Azure Cognitive Search to finish out the five-part series!
This post is part of Azure Spring Clean 2023