azure-mgmt-botservice-dotnet – skill DevOps & Hạ tầng cho agent AI
SDK Azure Resource Manager cho Bot Service trong .NET. Thao tác mặt phẳng quản lý để tạo và quản lý tài nguyên Azure Bot, các kênh (Teams, DirectLine, Slack) và cấu hình kết nối.
Cài skill azure-mgmt-botservice-dotnet bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-mgmt-botservice-dotnet-57587.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /azure-mgmt-botservice-dotnet – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-mgmt-botservice-dotnet-57587.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $azure-mgmt-botservice-dotnet – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-mgmt-botservice-dotnet-57587.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /azure-mgmt-botservice-dotnet – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-mgmt-botservice-dotnet-57587.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /azure-mgmt-botservice-dotnet – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Azure.ResourceManager.BotService (.NET)
Management plane SDK for provisioning and managing Azure Bot Service resources via Azure Resource Manager.
Provisioning and lifecycle scope
These are historical SDK fragments. Verify current package/service lifecycle, supported app identity types and the target tenant before creating resources; do not assume every channel or multi-tenant configuration is available for new bots. Select the exact subscription/resource group instead of relying on an unintended default. Pin packages, validate signatures/imports and use approved test resources. Creating channels exposes messaging surfaces; deleting bots and regenerating DirectLine keys can interrupt clients. Require corresponding user authority, stage rotation and protect returned keys from logs. Credential-chain choice must be deliberate in production.
Installation
dotnet add package Azure.ResourceManager.BotService
dotnet add package Azure.IdentityHistorical example versions: v1.1.1 / v1.1.0-beta.1; check supported versions and migration guidance before use.
Environment Variables
AZURE_SUBSCRIPTION_ID=<your-subscription-id>
# For service principal auth (optional)
AZURE_TENANT_ID=<tenant-id>
AZURE_CLIENT_ID=<client-id>
AZURE_CLIENT_SECRET=<client-secret>Authentication
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.BotService;
// Authenticate using DefaultAzureCredential
var credential = new DefaultAzureCredential();
ArmClient armClient = new ArmClient(credential);
// Get subscription and resource group
SubscriptionResource subscription = await armClient.GetDefaultSubscriptionAsync();
ResourceGroupResource resourceGroup = await subscription.GetResourceGroups().GetAsync("myResourceGroup");
// Access bot collection
BotCollection botCollection = resourceGroup.GetBots();Resource Hierarchy
ArmClient
└── SubscriptionResource
└── ResourceGroupResource
└── BotResource
├── BotChannelResource (DirectLine, Teams, Slack, etc.)
├── BotConnectionSettingResource (OAuth connections)
└── BotServicePrivateEndpointConnectionResourceCore Workflows
1. Create Bot Resource
using Azure.ResourceManager.BotService;
using Azure.ResourceManager.BotService.Models;
// Create bot data
var 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 bot
ArmOperation<BotResource> operation = await botCollection.CreateOrUpdateAsync(
WaitUntil.Completed,
"myBotName",
botData);
BotResource bot = operation.Value;
Console.WriteLine($"Bot created: {bot.Data.Name}");2. Configure DirectLine Channel
// Get the bot
BotResource bot = await resourceGroup.GetBots().GetAsync("myBotName");
// Get channel collection
BotChannelCollection channels = bot.GetBotChannels();
// Create DirectLine channel configuration
var 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 channel
ArmOperation<BotChannelResource> channelOp = await channels.CreateOrUpdateAsync(
WaitUntil.Completed,
BotChannelName.DirectLineChannel,
channelData);
Console.WriteLine("DirectLine channel configured");3. Configure Microsoft Teams Channel
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
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
// Get bot
BotResource bot = await botCollection.GetAsync("myBotName");
Console.WriteLine($"Bot: {bot.Data.Properties.DisplayName}");
Console.WriteLine($"Endpoint: {bot.Data.Properties.Endpoint}");
// List channels
await foreach (BotChannelResource channel in bot.GetBotChannels().GetAllAsync())
{
Console.WriteLine($"Channel: {channel.Data.Name}");
}6. Regenerate DirectLine Keys
var regenerateRequest = new BotChannelRegenerateKeysContent(BotChannelName.DirectLineChannel)
{
SiteName = "Default Site"
};
BotChannelResource channelWithKeys = await bot.GetBotChannelWithRegenerateKeysAsync(regenerateRequest);7. Update Bot
BotResource bot = await botCollection.GetAsync("myBotName");
// Update using patch
var 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
BotResource bot = await botCollection.GetAsync("myBotName");
await bot.DeleteAsync(WaitUntil.Completed);Supported Channel Types
| Channel | Constant | Class |
|---------|----------|-------|
| Direct Line | BotChannelName.DirectLineChannel | DirectLineChannel |
| Direct Line Speech | BotChannelName.DirectLineSpeechChannel | DirectLineSpeechChannel |
| Microsoft Teams | BotChannelName.MsTeamsChannel | MsTeamsChannel |
| Web Chat | BotChannelName.WebChatChannel | WebChatChannel |
| Slack | BotChannelName.SlackChannel | SlackChannel |
| Facebook | BotChannelName.FacebookChannel | FacebookChannel |
| Email | BotChannelName.EmailChannel | EmailChannel |
| Telegram | BotChannelName.TelegramChannel | TelegramChannel |
| Telephony | BotChannelName.TelephonyChannel | TelephonyChannel |
Key Types Reference
| Type | Purpose |
|------|---------|
| ArmClient | Entry point for all ARM operations |
| BotResource | Represents an Azure Bot resource |
| BotCollection | Collection for bot CRUD |
| BotData | Bot resource definition |
| BotProperties | Bot configuration properties |
| BotChannelResource | Channel configuration |
| BotChannelCollection | Collection of channels |
| BotChannelData | Channel configuration data |
| BotConnectionSettingResource | OAuth connection settings |
BotServiceKind Values
| Value | Description |
|-------|-------------|
| BotServiceKind.Azurebot | Azure Bot (recommended) |
| BotServiceKind.Bot | Legacy Bot Framework bot |
| BotServiceKind.Designer | Composer bot |
| BotServiceKind.Function | Function bot |
| BotServiceKind.Sdk | SDK bot |
BotServiceSkuName Values
| Value | Description |
|-------|-------------|
| BotServiceSkuName.F0 | Free tier |
| BotServiceSkuName.S1 | Standard tier |
BotMsaAppType Values
| Value | Description |
|-------|-------------|
| BotMsaAppType.MultiTenant | Multi-tenant app |
| BotMsaAppType.SingleTenant | Single-tenant app |
| BotMsaAppType.UserAssignedMSI | User-assigned managed identity |
Best Practices
1. Always 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
using Azure;
try
{
var operation = await botCollection.CreateOrUpdateAsync(
WaitUntil.Completed,
botName,
botData);
}
catch (RequestFailedException ex) when (ex.Status == 409)
{
Console.WriteLine("Bot already ex… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- azure-mgmt-botservice-py – SDK quản lý Azure Bot Service cho Python. Dùng để tạo, quản lý và cấu hình tài nguyên…
- azure-mgmt-fabric-dotnet – SDK Azure Resource Manager cho Fabric trong .NET.
- azure-mgmt-fabric-py – SDK quản lý Azure Fabric cho Python. Dùng để quản lý dung lượng và tài nguyên Microsoft…
- azure-mgmt-mongodbatlas-dotnet – Quản lý tổ chức MongoDB Atlas như tài nguyên ARM của Azure, với thanh toán hợp nhất qua…
- azure-mgmt-weightsandbiases-dotnet – SDK Azure Weights & Biases cho .NET. Theo dõi thí nghiệm ML và quản lý mô hình qua Azure…
- mtls-configuration – Cấu hình mutual TLS (mTLS) cho giao tiếp zero-trust giữa các dịch vụ. Dùng khi triển…
- multi-cloud-architecture – Thiết kế kiến trúc multi-cloud bằng khung quyết định để chọn và tích hợp dịch vụ trên…
- azure-microsoft-playwright-testing-ts – Chạy test Playwright ở quy mô lớn với trình duyệt đám mây và báo cáo tích hợp trên Azure…