Azure Mgmt Botservice Dotnet

by microsoft354361d83247MITListed Oct 8, 2026Updated Oct 8, 2026

Azure Resource Manager SDK for Bot Service in .NET. Management plane operations for creating and managing Azure Bot resources, channels (Teams, DirectLine, Slack), and connection settings. Triggers: "Bot Service", "BotResource", "Azure Bot", "DirectLine channel", "Teams channel", "bot management .NET", "create bot".

FeaturedInstructions only

Azure.ResourceManager.BotService (.NET)

Management plane SDK for provisioning and managing Azure Bot Service resources via Azure Resource Manager.

Installation

bash
dotnet add package Azure.ResourceManager.BotServicedotnet add package Azure.Identity

Current Versions: Stable v1.1.1, Preview v1.1.0-beta.1

Environment Variables

bash
AZURE_SUBSCRIPTION_ID=<your-subscription-id> # Required: Azure subscription IDAZURE_TOKEN_CREDENTIALS=prod  # Required only if DefaultAzureCredential is used in productionAZURE_TENANT_ID=<tenant-id> # For service principal auth (optional)AZURE_CLIENT_ID=<client-id> # For service principal auth (optional)AZURE_CLIENT_SECRET=<client-secret> # For service principal auth (optional)

Authentication

csharp
using Azure.Identity;using Azure.ResourceManager;using Azure.ResourceManager.BotService;
// Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=<specific_credential>var credential = new DefaultAzureCredential(    DefaultAzureCredential.DefaultEnvironmentVariableName);// Or use a specific credential directly in production:// See https://learn.microsoft.com/dotnet/api/overview/azure/identity-readme?view=azure-dotnet#credential-classes// var credential = new ManagedIdentityCredential();ArmClient armClient = new ArmClient(credential);
// Get subscription and resource groupSubscriptionResource subscription = await armClient.GetDefaultSubscriptionAsync();ResourceGroupResource resourceGroup = await subscription.GetResourceGroups().GetAsync("myResourceGroup");
// Access bot collectionBotCollection botCollection = resourceGroup.GetBots();

Resource Hierarchy

ArmClient└── SubscriptionResource    └── ResourceGroupResource        └── BotResource            ├── BotChannelResource (DirectLine, Teams, Slack, etc.)            ├── BotConnectionSettingResource (OAuth connections)            └── BotServicePrivateEndpointConnectionResource

Core Workflows

1. Create Bot Resource

csharp
using Azure.ResourceManager.BotService;using Azure.ResourceManager.BotService.Models;
// Create bot datavar botData = new BotData(AzureLocation.WestUS2){    Kind = BotServiceKind.Azurebot,    Sku = new BotServiceSku(BotServiceSkuName.F0),    Properties = new BotProperties(        displayName: "MyBot",        endpoint: new Uri("https://mybot.azurewebsites.net/api/messages"),        msaAppId: "<your-msa-app-id>")    {        Description = "My Azure Bot",        MsaAppType = BotMsaAppType.MultiTenant    }};
// Create or update the botArmOperation<BotResource> operation = await botCollection.CreateOrUpdateAsync(    WaitUntil.Completed,     "myBotName",     botData);    BotResource bot = operation.Value;Console.WriteLine($"Bot created: {bot.Data.Name}");

2. Configure DirectLine Channel

csharp
// Get the botBotResource bot = await resourceGroup.GetBots().GetAsync("myBotName");
// Get channel collectionBotChannelCollection channels = bot.GetBotChannels();
// Create DirectLine channel configurationvar channelData = new BotChannelData(AzureLocation.WestUS2){    Properties = new DirectLineChannel()    {        Properties = new DirectLineChannelProperties()        {            Sites =             {                new DirectLineSite("Default Site")                {                    IsEnabled = true,                    IsV1Enabled = false,                    IsV3Enabled = true,                    IsSecureSiteEnabled = true                }            }        }    }};
// Create or update the channelArmOperation<BotChannelResource> channelOp = await channels.CreateOrUpdateAsync(    WaitUntil.Completed,    BotChannelName.DirectLineChannel,    channelData);
Console.WriteLine("DirectLine channel configured");

3. Configure Microsoft Teams Channel

csharp
var teamsChannelData = new BotChannelData(AzureLocation.WestUS2){    Properties = new MsTeamsChannel()    {        Properties = new MsTeamsChannelProperties()        {            IsEnabled = true,            EnableCalling = false        }    }};
await channels.CreateOrUpdateAsync(    WaitUntil.Completed,    BotChannelName.MsTeamsChannel,    teamsChannelData);

4. Configure Web Chat Channel

csharp
var webChatChannelData = new BotChannelData(AzureLocation.WestUS2){    Properties = new WebChatChannel()    {        Properties = new WebChatChannelProperties()        {            Sites =            {                new WebChatSite("Default Site")                {                    IsEnabled = true                }            }        }    }};
await channels.CreateOrUpdateAsync(    WaitUntil.Completed,    BotChannelName.WebChatChannel,    webChatChannelData);

5. Get Bot and List Channels

csharp
// Get botBotResource bot = await botCollection.GetAsync("myBotName");Console.WriteLine($"Bot: {bot.Data.Properties.DisplayName}");Console.WriteLine($"Endpoint: {bot.Data.Properties.Endpoint}");
// List channelsawait foreach (BotChannelResource channel in bot.GetBotChannels().GetAllAsync()){    Console.WriteLine($"Channel: {channel.Data.Name}");}

6. Regenerate DirectLine Keys

csharp
var regenerateRequest = new BotChannelRegenerateKeysContent(BotChannelName.DirectLineChannel){    SiteName = "Default Site"};
BotChannelResource channelWithKeys = await bot.GetBotChannelWithRegenerateKeysAsync(regenerateRequest);

7. Update Bot

csharp
BotResource bot = await botCollection.GetAsync("myBotName");
// Update using patchvar updateData = new BotData(bot.Data.Location){    Properties = new BotProperties(        displayName: "Updated Bot Name",        endpoint: bot.Data.Properties.Endpoint,        msaAppId: bot.Data.Properties.MsaAppId)    {        Description = "Updated description"    }};
await bot.UpdateAsync(updateData);

8. Delete Bot

csharp
BotResource bot = await botCollection.GetAsync("myBotName");await bot.DeleteAsync(WaitUntil.Completed);

Supported Channel Types

ChannelConstantClass
Direct LineBotChannelName.DirectLineChannelDirectLineChannel
Direct Line SpeechBotChannelName.DirectLineSpeechChannelDirectLineSpeechChannel
Microsoft TeamsBotChannelName.MsTeamsChannelMsTeamsChannel
Web ChatBotChannelName.WebChatChannelWebChatChannel
SlackBotChannelName.SlackChannelSlackChannel
FacebookBotChannelName.FacebookChannelFacebookChannel
EmailBotChannelName.EmailChannelEmailChannel
TelegramBotChannelName.TelegramChannelTelegramChannel
TelephonyBotChannelName.TelephonyChannelTelephonyChannel

Key Types Reference

TypePurpose
ArmClientEntry point for all ARM operations
BotResourceRepresents an Azure Bot resource
BotCollectionCollection for bot CRUD
BotDataBot resource definition
BotPropertiesBot configuration properties
BotChannelResourceChannel configuration
BotChannelCollectionCollection of channels
BotChannelDataChannel configuration data
BotConnectionSettingResourceOAuth connection settings

BotServiceKind Values

ValueDescription
BotServiceKind.AzurebotAzure Bot (recommended)
BotServiceKind.BotLegacy Bot Framework bot
BotServiceKind.DesignerComposer bot
BotServiceKind.FunctionFunction bot
BotServiceKind.SdkSDK bot

BotServiceSkuName Values

ValueDescription
BotServiceSkuName.F0Free tier
BotServiceSkuName.S1Standard tier

BotMsaAppType Values

ValueDescription
BotMsaAppType.MultiTenantMulti-tenant app
BotMsaAppType.SingleTenantSingle-tenant app
BotMsaAppType.UserAssignedMSIUser-assigned managed identity

Best Practices

  1. Use DefaultAzureCredential — supports multiple auth methods
  2. Use WaitUntil.Completed for synchronous operations
  3. Handle RequestFailedException for API errors
  4. Use async methods (*Async) for all operations
  5. Store MSA App credentials securely — use Key Vault for secrets
  6. Use managed identity (BotMsaAppType.UserAssignedMSI) for production bots
  7. Enable secure sites for DirectLine channels in production

Error Handling

csharp
using Azure;
try{    var operation = await botCollection.CreateOrUpdateAsync(        WaitUntil.Completed,         botName,         botData);}catch (RequestFailedException ex) when (ex.Status == 409){    Console.WriteLine("Bot already exists");}catch (RequestFailedException ex){    Console.WriteLine($"ARM Error: {ex.Status} - {ex.ErrorCode}: {ex.Message}");}

Related SDKs

SDKPurposeInstall
Azure.ResourceManager.BotServiceBot management (this SDK)dotnet add package Azure.ResourceManager.BotService
Microsoft.Bot.BuilderBot Framework SDKdotnet add package Microsoft.Bot.Builder
Microsoft.Bot.Builder.Integration.AspNet.CoreASP.NET Core integrationdotnet add package Microsoft.Bot.Builder.Integration.AspNet.Core

Reference Links

Source and attribution

Source:microsoft/skillsin.github/plugins/azure-sdk-dotnet/skills/azure-mgmt-botservice-dotnetat commit354361d

License: MIT

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal

More from microsoft/skills

Azure Mgmt Fabric Dotnet

microsoft

Featured

Guides .NET management-plane provisioning and lifecycle of Microsoft Fabric capacities via Azure Resource Manager.

DevOps & CloudOct 8, 2026

Azure Communication Common Java

microsoft

Featured

Reference for Azure Communication Services common Java utilities: token credentials, refresh, and user identifiers.

Software DevelopmentOct 8, 2026

Azure Communication Chat Java

microsoft

Featured

Guides Java developers in building real-time chat features with the Azure Communication Services Chat SDK.

Software DevelopmentOct 8, 2026

Azure Mgmt Arizeaiobservabilityeval Dotnet

microsoft

Featured

Azure Resource Manager SDK for Arize AI Observability and Evaluation (.NET). Use when managing Arize AI organizations on Azure via Azure Marketplace, creating/updating/deleting Arize resources, or integrating Arize ML observability into .NET applications. Triggers: "Arize AI", "ML observability", "ArizeAIObservabilityEval", "Arize organization".

Awaiting classificationOct 8, 2026

Azure Mgmt Applicationinsights Dotnet

microsoft

Featured

Azure Application Insights SDK for .NET. Application performance monitoring and observability resource management. Use for creating Application Insights components, web tests, workbooks, analytics items, and API keys. Triggers: "Application Insights", "ApplicationInsights", "App Insights", "APM", "application monitoring", "web tests", "availability tests", "workbooks".

Awaiting classificationOct 8, 2026

Azure Mgmt Apimanagement Dotnet

microsoft

Featured

Guides .NET management-plane provisioning of Azure API Management services, APIs, products, subscriptions and policies via Azure Resource Manager.

DevOps & CloudOct 8, 2026