CloudBrum
CloudBrum · Cloud decision-support platform
Azure AI and machine learning

Azure Bot ServiceCreatedLast reviewedReading time~18 minLevelBeginner to advanced

Microsoft Azure · AI and machine learning · Bot channels and identity

Azure Bot Service connects a bot application to supported conversation channels. The Azure Bot resource registers its identity and messaging endpoint; it does not, by itself, host the application or supply a trained language model. A web chat therefore needs several working parts: the channel, an authenticated endpoint and code that knows what to do with a message. Microsoft now points new code-based development to the Microsoft 365 Agents SDK; older Bot Framework SDK tutorials need a lifecycle check.

On this page (17 sections)

    Mind map: Azure Bot Service at a glance

    Azure Bot Service mind map Azure Bot Service at a glance: Registration: Bot resource, Messaging endpoint, Configured app identity; Application: Agents SDK for new work, Host the web endpoint, Persist needed state; Channels: Enable chosen channels, Test channel behavior, Publish required manifests; Direct Line: Backend issues a token, Bind the user ID, Refresh before expiry; Receiving: Activities are asynchronous, Keep the watermark, Ignore user echoes; Access: Validate channel requests, Authenticate the customer, Authorize business APIs; Operations: Host latency and errors, Redacted telemetry, Conversation recovery; Budget: Channel plan, Compute and storage, AI and downstream services. Azure Bot Service at a glance A channel registration reaches your application; the application owns the conversation CloudBrum Cloud decision-support platform CloudBrum Bot resource Messaging endpoint Configured app identity Registration Agents SDK for new work Host the web endpoint Persist needed state Application Enable chosen channels Test channel behavior Publish required manifests Channels Backend issues a token Bind the user ID Refresh before expiry Direct Line Activities are asynchronous Keep the watermark Ignore user echoes Receiving Validate channel requests Authenticate the customer Authorize business APIs Access Host latency and errors Redacted telemetry Conversation recovery Operations Channel plan Compute and storage AI and downstream services Budget Azure Bot17-point analysis CloudBrum· 17-point cloud service analysis cloudbrum.com
    CloudBrum Azure Bot at a glance · 17-point analysis Registration Bot resource Messaging endpoint Configured app identity Application Agents SDK for new work Host the web endpoint Persist needed state Channels Enable chosen channels Test channel behavior Publish required manifests Direct Line Backend issues a token Bind the user ID Refresh before expiry Receiving Activities are asynchronous Keep the watermark Ignore user echoes Access Validate channel requests Authenticate the customer Authorize business APIs Operations Host latency and errors Redacted telemetry Conversation recovery Budget Channel plan Compute and storage AI and downstream services CloudBrum · cloudbrum.com

    Free to share. The downloaded image includes the CloudBrum link.

    Key features (summary)

    • A common channel entry pointThe Azure Bot registration points supported channels at a messaging endpoint. An endpoint that works locally still needs correct credentials, HTTPS reachability and channel configuration before it can receive production traffic.
    • An application identityThe registration and the hosted agent must agree on their identity settings. Microsoft documents user-assigned managed identity and other supported authentication options; selecting an identity type in one resource does not configure the host automatically.
    • Web and application conversationsDirect Line lets a custom client exchange activities with the bot. Your backend can issue a short-lived conversation token so the client never needs the channel’s long-lived secret.
    • Asynchronous activitiesSending a message and receiving a reply are separate operations. Clients can receive typing events, attachments, several messages or a delayed response. A design that assumes one synchronous string for each POST loses that distinction.
    • Your choice of dialogue and AIThe hosted application decides how to route a request and which language or model services to call. Add those services for a measured purpose; a Bot Service resource alone is not a replacement for Lex intents or a generative agent application.
    • Channel-specific publishingWeb Chat, Teams and other integrations have their own presentation and deployment requirements. Reusing the backend does not mean an attachment, authentication prompt or app manifest behaves identically in every channel.

    Basic concepts

    Bot resource versus bot process
    The registration stores service configuration. The application process runs your code, often on App Service or another suitable host. Creating only the registration leaves nothing behind the messaging URL.
    Activity
    An activity is a conversation event, not necessarily a text message. Check its type and sender before displaying it or using it to advance application state.
    Three identity boundaries
    The bot’s workload identity, a channel conversation token and the customer’s authenticated account solve different problems. A Direct Line token grants a conversation connection; it is not permission to read an arbitrary customer record.
    Watermark
    Direct Line returns an opaque receive position. Keep the previous position when a response has a null or missing watermark, and use the saved value when reconnecting.
    SDK lifecycle
    The Bot Framework SDK and Emulator have been archived. Microsoft stopped servicing SDK support tickets on 31 December 2025 and recommends the Agents SDK for new code-based agents; this does not mean every Azure Bot registration was shut down.
    Persistent state
    In-memory state is convenient during development but does not survive all restarts or multiple host instances. Choose a durable store and an explicit retention policy for conversation and business state that must outlive a process.

    How to create & configure it

    Connect a hosted agent to a web conversation

    1. Implement a small authenticated agentStart with the current Microsoft 365 Agents SDK quickstart. Add one synthetic support interaction and a refusal path for an unauthorized request before connecting a real business system.
    2. Create the workload identity and registrationProvision a supported bot identity and an Azure Bot resource. The example uses UserAssignedMSI. Keep the identity resource ID, client ID and tenant settings together so the host and registration describe the same principal.
    3. Deploy a reachable messaging endpointDeploy the application, attach its managed identity where required and configure its connection. Set the registration’s endpoint to the real HTTPS messaging route, normally ending in /api/messages. A placeholder URL cannot receive channel traffic.
    4. Enable and test the chosen channelUse Test in Web Chat for an initial check, then configure the actual target channel. A Teams agent also needs the relevant manifest and deployment steps; a successful portal test does not publish a Teams application.
    5. Issue Direct Line tokens from the backendFor a custom web client, enable Direct Line and build a protected token broker. Bind an unguessable dl_ user ID and approved origins as required. Store any channel secret in an appropriate secret store such as Key Vault, not in client JavaScript.
    6. Receive activities and exercise recoveryKeep the conversation ID and watermark, distinguish user echoes from bot messages, and refresh tokens using their returned expiry. Test a slow reply, a disconnect and several bot messages before calling the client complete.

    When a chat goes silent, check the delivery path in order: channel authentication, messaging endpoint, application logs and downstream dependencies. A language-model change cannot repair an endpoint that never received the activity.

    Common issues after configuration

    SymptomLikely causeWhat to check / fix
    The Azure Bot exists but never repliesThe application is absent, unreachable or configured with a different identityInspect the deployed endpoint and the actual host identity. Registration, application deployment and channel enablement are separate steps.
    Direct Line rejects a token (401/403)The token is invalid, expired, from the wrong conversation or paired with the wrong user IDObtain a fresh conversation token through the backend and follow its binding and expiry rules. Do not solve a browser error by exposing the channel secret to the page.
    The client displays its own message as a bot replyThe activity receiver does not check sender and typeIgnore the customer’s outbound activity when presenting bot messages. Keep typing and other non-message activities in their own handling path.
    Replies disappear after reconnectingThe client lost its receive positionPersist the last usable watermark and resume from it. Null or missing values must not overwrite a known position; deduplicate activities when recovery can replay them.
    A channel works in the portal but fails elsewhereThe target channel has different configuration, credentials or publishing requirementsReproduce through the real client and inspect the channel’s endpoint and app settings. Check manifests, supported activity features and user authorization separately.
    Conversation state vanishes during scale-outState only lives in one application instanceStore necessary state durably, for example in an appropriately designed Cosmos DB application store. Review concurrent updates and deletion across the host fleet.

    Use cases: when and where to use it

    Good fit

    • A developer-owned bot that needs supported channel connections and a controlled application endpoint.
    • A custom web experience whose backend can issue conversation-scoped credentials.
    • An existing Azure application that needs to reuse its own business authorization and integrations.
    • A migration that separates Bot Framework SDK code changes from the continued channel registration.

    Consider something else

    • A business team wants a managed visual authoring platform: evaluate Microsoft Copilot Studio.
    • The work is only a private backend model call: a direct model or Foundry integration may not need a bot channel resource.
    • No team owns hosting, state, telemetry or channel failures: a registration cannot fill that operational gap.
    • A protected action cannot be authorized at the application backend: restrict the bot to non-sensitive information until that boundary exists.

    Pros: why consider it?

    Why teams choose it

    • A channel registration lets one application serve multiple supported conversation surfaces.
    • Workload identity can reduce reliance on application secrets when the chosen host supports it.
    • Direct Line offers a standard route for a custom client to exchange activities.
    • The application remains free to choose its dialogue logic, data stores and AI services.

    Trade-offs to weigh

    • Several separately configured components must agree before the first message works.
    • Channel behavior and publishing differ, so each user experience needs its own test.
    • Hosting, durable state and language understanding require additional design and budget.
    • Older SDK examples can appear plausible even when their dependencies are no longer maintained.

    Common threats, vulnerabilities & risks

    RiskSeverityWhy it mattersMitigation
    A browser receives a long-lived channel secretHighAn attacker can copy a client-side secret and use it outside the intended website.Keep token generation on a trusted backend and give the client only the scoped token it needs.
    A conversation token is treated as customer authorizationHighA connected client asks for records that belong to a different account.Authenticate the customer and check record-level permissions at the business API.
    An unsigned or invalid activity reaches application logicHighAn endpoint accepts a message without the channel authentication the SDK expects.Keep production request validation enabled and test rejection as well as successful delivery.
    State is shared between peopleHighThe application reuses conversation keys or stores user-specific data under a global identifier.Scope state to the correct principal/conversation and test account switching and concurrent sessions.
    An abandoned SDK becomes a production dependencyMediumA team copies an old tutorial without checking its maintenance status.Use current Agents SDK guidance and plan an explicit migration for Bot Framework SDK applications.
    Telemetry becomes an uncontrolled transcript archiveMediumMessage bodies and attachments are retained in traces, error reports and exports.Collect operational evidence without unnecessary content, and define access and deletion for retained conversations.

    Performance optimisation

    • Measure channel-to-application delivery separately from downstream model and API latency.
    • Keep a receiving client alive after the first reply; one answer may arrive as several activities.
    • Reuse HTTP connections and the SDK’s supported credential handling.
    • Scale durable conversation state with the application instead of relying on a sticky development instance.
    • Watch cold starts and dependency delays on the chosen host.
    • Test under the actual channel’s message patterns rather than extrapolating from a single portal prompt.

    Reduce monthly cost

    The registration is one line in the budget. The larger items can be the application host, AI calls and the work needed to keep conversation delivery reliable across channels.

    • Count the messages and channel types that apply to the Bot Service plan.
    • Add the web host, durable state, monitoring and network costs.
    • Budget language, speech, search and model services separately from message delivery.
    • Include token-broker and business-API traffic in a custom-client design.
    • Use redacted telemetry with a deliberate retention period rather than retaining every payload indefinitely.
    • Compare a visual managed bot product with the maintenance cost of a custom application when choosing the ownership model.

    “Free channel messages” does not mean the complete assistant is free. Hosting, premium-channel usage beyond its allowance and connected Azure services have their own meters.

    Security optimisation

    • Prefer a supported workload-identity configuration and attach the same identity to the host where required.
    • Issue short-lived Direct Line credentials through a trusted server and expose only that token to the web client.
    • Validate incoming channel requests with the current SDK authentication path.
    • Authorize protected actions using the customer’s verified account, not a name typed into chat.
    • Use approved channel endpoints and hosting locations that meet the applicable data requirements.
    • Review message attachments, transcript exports, operational logs and application-state retention together.

    Governance & compliance

    Guardrails

    • Assign owners for the registration, hosted code, channel publishing and business integrations.
    • Keep an inventory of SDK versions and the credentials/identities each component uses.
    • Document which tasks require user authentication and which actions require an additional approval.

    Delivery and access checks

    • Alert on channel delivery failures, endpoint errors and token-broker outages.
    • Test credential expiry, reconnect behavior and deletion of retained conversation state.
    • Review permissions after adding a new channel or business-system integration.

    The Azure Bot resource’s location does not by itself describe every place a conversation is processed. Include the channel, application host, AI dependencies, state store and telemetry destinations in a residency review.

    Reduce carbon footprint

    • Remove unused hosting instances and abandoned development bots after testing.
    • Avoid repeatedly polling for a conversation that the client has already closed.
    • Keep only the conversation evidence needed for operation and the approved retention period.
    • Assess the full hosted workload before attributing a sustainability benefit to channel consolidation.

    Pricing

    Purchase options

    Standard channels Plan allowance

    The pricing table lists unlimited standard-channel messages for the Free and S1 plans; connected services are separate.

    Premium channels Message meter

    The Free plan lists 10,000 premium-channel messages per month. Confirm the S1 rate for the applicable offer rather than inferring it from a blank dynamic price.

    Application hosting Chosen Azure compute plan

    A bot registration does not include a free production web host, storage or all networking.

    AI and diagnostics Dependency meters

    Language, speech, models, telemetry and downstream tools can dominate the cost of a useful conversation.

    What you actually pay for

    • Applicable channel-plan and premium-message usage.
    • The application’s compute, durable state and network resources.
    • Language understanding, speech, search or generative-model services the application calls.
    • Diagnostics, transcript storage and connected business systems.

    Consult the official Azure AI Bot Service pricing page for the current plan and offer. The checked public page exposes the allowances but renders the S1 premium unit price dynamically; no dollar rate is invented here.

    Important code references

    Create an Agents SDK application and a reachable host first. The setup tabs provision a user-assigned identity and bot registration; attach that identity to the host and configure its SDK connection separately. The Python example uses an already-enabled Direct Line channel with a backend-issued token and bound user ID. C# reads the saved activity batch. This is a small client exchange, not a complete Web Chat implementation or a backend token broker.

    # Azure CLI signed in to your test subscription; the host already exists.
    BOT_RG=cloudbrum-bot-demo
    BOT_REGION=eastus
    BOT_NAME=replace-with-unique-bot-name
    BOT_ENDPOINT=https://replace-with-your-host.example/api/messages
    az group create --name "$BOT_RG" --location "$BOT_REGION"
    az identity create --name bot-runtime --resource-group "$BOT_RG" --location "$BOT_REGION"
    BOT_CLIENT_ID=$(az identity show --name bot-runtime --resource-group "$BOT_RG" --query clientId -o tsv) || exit 1
    BOT_IDENTITY_ID=$(az identity show --name bot-runtime --resource-group "$BOT_RG" --query id -o tsv) || exit 1
    BOT_TENANT_ID=$(az account show --query tenantId -o tsv) || exit 1
    BOT_SUBSCRIPTION_ID=$(az account show --query id -o tsv) || exit 1
    cat > bot-registration.json <<JSON
    {"location":"global","kind":"azurebot","sku":{"name":"F0"},
     "properties":{"displayName":"CloudBrum support demo","endpoint":"$BOT_ENDPOINT",
     "msaAppType":"UserAssignedMSI","msaAppId":"$BOT_CLIENT_ID",
     "msaAppTenantId":"$BOT_TENANT_ID","msaAppMSIResourceId":"$BOT_IDENTITY_ID"}}
    JSON
    az rest --method put --body @bot-registration.json \
      --url "https://management.azure.com/subscriptions/$BOT_SUBSCRIPTION_ID/resourceGroups/$BOT_RG/providers/Microsoft.BotService/botServices/$BOT_NAME?api-version=2022-09-15"
    # Attach BOT_IDENTITY_ID to the host and configure the SDK connection.
    # Enable Direct Line separately. Never fetch its secret into a public client.
    terraform {
      required_providers {
        azurerm = { source = "hashicorp/azurerm", version = "~> 4.0" }
      }
    }
    provider "azurerm" { features {} }
    variable "messaging_endpoint" { type = string }
    variable "bot_name" { type = string }
    data "azurerm_client_config" "current" {}
    resource "azurerm_resource_group" "bot" {
      name     = "cloudbrum-bot-demo"
      location = "eastus"
    }
    resource "azurerm_user_assigned_identity" "bot" {
      name                = "bot-runtime"
      resource_group_name = azurerm_resource_group.bot.name
      location            = azurerm_resource_group.bot.location
    }
    resource "azurerm_bot_service_azure_bot" "bot" {
      name                      = var.bot_name
      resource_group_name       = azurerm_resource_group.bot.name
      location                  = "global"
      sku                       = "F0"
      microsoft_app_id          = azurerm_user_assigned_identity.bot.client_id
      microsoft_app_type        = "UserAssignedMSI"
      microsoft_app_msi_id      = azurerm_user_assigned_identity.bot.id
      microsoft_app_tenant_id   = data.azurerm_client_config.current.tenant_id
      endpoint                  = var.messaging_endpoint
    }
    # This does not deploy a web host, configure its identity or enable a channel.
    # Complete those steps before trying the Direct Line client.
    # pip install requests
    import json
    import os
    import time
    import requests
    
    BASE = "https://directline.botframework.com/v3/directline"
    
    
    def receive_messages(http, conversation_id, user_id, watermark=None, seen_ids=None):
        seen_ids = seen_ids if seen_ids is not None else set()
        params = {} if watermark is None else {"watermark": watermark}
        response = http.get(
            f"{BASE}/conversations/{conversation_id}/activities",
            params=params, timeout=(5, 20),
        )
        response.raise_for_status()
        payload = response.json()
        messages = []
        for activity in payload.get("activities", []):
            activity_id = activity.get("id")
            if not activity_id or activity_id in seen_ids:
                continue
            seen_ids.add(activity_id)
            sender = activity.get("from", {}).get("id")
            if activity.get("type") == "message" and sender and sender != user_id:
                messages.append(activity)
        supplied = payload.get("watermark")
        # Direct Line explicitly says not to replace a saved watermark with null.
        next_watermark = watermark if supplied is None else supplied
        return messages, next_watermark, payload
    
    
    if __name__ == "__main__":
        # Obtain both values from your trusted token broker, not from a channel secret.
        token = os.environ["DIRECT_LINE_TOKEN"]
        user_id = os.environ["DIRECT_LINE_USER_ID"]
        if not user_id.startswith("dl_"):
            raise ValueError("Use the user ID bound by the token broker.")
        with requests.Session() as http:
            http.headers["Authorization"] = "Bearer " + token
            started = http.post(f"{BASE}/conversations", timeout=(5, 20))
            started.raise_for_status()
            conversation = started.json()["conversationId"]
            sent = http.post(
                f"{BASE}/conversations/{conversation}/activities",
                json={"type": "message", "from": {"id": user_id},
                      "text": "Hello, this is a synthetic support test."},
                timeout=(5, 20),
            )
            sent.raise_for_status()
            watermark, seen = None, set()
            payload = {}
            for _ in range(20):
                messages, watermark, payload = receive_messages(
                    http, conversation, user_id, watermark, seen
                )
                if messages:
                    print("Received bot message activities; continue the conversation.")
                    break
                time.sleep(0.5)
        fd = os.open("activity-batch.json", os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
        with os.fdopen(fd, "w", encoding="utf-8") as target:
            json.dump(payload, target)
        # Production clients keep receiving, retain watermarks and refresh before expiry.
        # An uncertain POST result must not trigger a blind replay of a business action.
    // .NET console app: dotnet run -- activity-batch.json dl_bound_user_id
    // Inspect a received batch; no Azure credentials or raw message printing.
    using System.Text.Json;
    
    using var json = JsonDocument.Parse(File.ReadAllText(args[0]));
    var userId = args[1];
    if (!json.RootElement.TryGetProperty("activities", out var activities) ||
        activities.ValueKind != JsonValueKind.Array)
    {
        Console.WriteLine("No activity array; inspect the response.");
        return;
    }
    var messages = 0;
    var seen = new HashSet<string>();
    foreach (var activity in activities.EnumerateArray())
    {
        if (!activity.TryGetProperty("id", out var id) ||
            id.GetString() is not string key || !seen.Add(key)) continue;
        if (!activity.TryGetProperty("type", out var type) ||
            type.GetString() != "message") continue;
        if (!activity.TryGetProperty("from", out var from) ||
            !from.TryGetProperty("id", out var sender) ||
            sender.GetString() == userId) continue;
        messages++;
    }
    Console.WriteLine($"{messages} non-user message activity/activities in this batch.");
    // A null/missing watermark must not replace one saved by a previous receive.
    // Message delivery does not establish completion or authorization of a business task.

    Best videos to explore

    The official Azure product page includes an overview video under “Watch the video”. Open that page to play it; no Microsoft player is loaded into this article. For implementation, follow the current Agents SDK references rather than treating a product overview as an SDK tutorial.

    Azure AI Bot Service — official product overview videoOfficial Microsoft Azure product video · Beginner · Watch on Microsoft Azure

    Interview questions

    BasicWhat does Azure Bot Service provide?

    It registers a bot identity and messaging endpoint and connects supported channels to the application. Hosting, dialogue logic, data access and AI capabilities are configured separately.

    BasicDoes creating an Azure Bot resource deploy my code?

    No. Deploy the agent as a web application or other supported host, configure its identity connection and set the real messaging endpoint in the registration. A resource with a placeholder URL cannot run the application.

    BasicWhich SDK should I use for a new code-based agent?

    Microsoft directs new work to the Microsoft 365 Agents SDK. The older Bot Framework SDK and Emulator are archived, and Bot Framework SDK support tickets stopped being serviced on 31 December 2025.

    IntermediateWas Azure Bot Service itself retired with the Bot Framework SDK?

    The cited notice concerns the SDK and Emulator, not an announcement that all Azure Bot registrations stopped operating. Review the current Bot Service and Agents SDK documentation for the application’s supported deployment path.

    IntermediateWhy prefer a user-assigned managed identity?

    Where supported by the host and connection configuration, it avoids managing an application secret for the bot identity. Provision the identity, attach it to the host and configure the SDK and registration consistently; creating it alone is not enough.

    IntermediateCan I put a Direct Line secret in my website?

    No. Keep that long-lived secret on a trusted backend. Give the client an appropriately scoped token, bind the intended user and origins as required, and refresh according to the returned expiry.

    IntermediateWhy do replies disappear after a reconnect?

    The receiver may have lost its conversation ID or watermark. Resume from the saved position, ignore null or missing watermark updates and deduplicate activities when replay is possible.

    IntermediateDoes a Direct Line token authorize access to customer data?

    It permits the channel connection for its scope. The application still needs to authenticate the customer and authorize access to each protected business resource. A conversation ID or typed account number is not sufficient evidence.

    AdvancedDoes Bot Service include language understanding?

    The application chooses its dialogue and language/model services. That differs from a managed intent-and-slot service such as Amazon Lex. Include the selected AI service, hosting and state store when comparing architecture and cost.

    AdvancedWhy does a portal test not prove a Teams deployment works?

    The target channel can require a manifest, credentials, publishing steps and presentation behavior that are absent from the portal test. Validate the actual client and its authentication flow.

    AdvancedWhat is included in Bot Service pricing?

    The channel plan has its own allowance and premium-message rules. Application hosting, state storage, diagnostics and connected AI or business services are separate cost items. Confirm current offer-specific rates on the pricing page.

    AdvancedHow does it compare with Lex and Google CX Agent Studio?

    Lex supplies managed NLU and dialogue state. Azure Bot Service connects channels to your hosted application. CX Agent Studio supplies a generative agent application platform. Choose around the required task, operational ownership and authorization boundary rather than treating their resource names as interchangeable.

    Similar or alternative services on other clouds

    CapabilityAWSAzureGoogle Cloud
    ServiceAmazon LexAzure Bot ServiceCustomer Experience Agent Studio
    What you provisionBot, locale, intent configuration and aliasIdentity/endpoint registration plus application hostAgent application, tools and deployment
    Conversation logicManaged intent/slot dialogueApplication code and selected AI stackGenerative agent behavior and evaluations
    Custom web integrationApplication calling Lex runtimeDirect Line activities with scoped credentialsCurrent Studio session API or supported channel
    State to inspectDialogue action and intent stateActivity stream and application-owned stateSession outputs, tool work and turn completion
    Release responsibilityVersion/alias and locale testsHost, SDK, identity and channel testsApplication version/deployment and regression tests

    An agent can run on App Service or a suitable Container Apps deployment. Use Key Vault for secrets that remain necessary and Azure Monitor for carefully scoped operational telemetry. Microsoft Foundry is an adjacent model/agent platform, not the same resource as the Bot Service channel registration.

    Did you find this article helpful?

    Your answer helps us improve this page for the next reader.

    Sources and further reading

    CloudBrum wrote this page in its own words, using the provider’s public documentation listed below as the reference. Features, limits, names and prices change, so confirm anything that matters on the provider’s own pages before you decide.