|
Add this skill
npx mdskills install sickn33/azure-mgmt-botservice-pyComprehensive SDK reference with detailed examples but lacks agent-specific trigger and execution logic
1---2name: azure-mgmt-botservice-py3description: |4 Azure Bot Service Management SDK for Python. Use for creating, managing, and configuring Azure Bot Service resources.5 Triggers: "azure-mgmt-botservice", "AzureBotService", "bot management", "conversational AI", "bot channels".6---78# Azure Bot Service Management SDK for Python910Manage Azure Bot Service resources including bots, channels, and connections.1112## Installation1314```bash15pip install azure-mgmt-botservice16pip install azure-identity17```1819## Environment Variables2021```bash22AZURE_SUBSCRIPTION_ID=<your-subscription-id>23AZURE_RESOURCE_GROUP=<your-resource-group>24```2526## Authentication2728```python29from azure.identity import DefaultAzureCredential30from azure.mgmt.botservice import AzureBotService31import os3233credential = DefaultAzureCredential()34client = AzureBotService(35 credential=credential,36 subscription_id=os.environ["AZURE_SUBSCRIPTION_ID"]37)38```3940## Create a Bot4142```python43from azure.mgmt.botservice import AzureBotService44from azure.mgmt.botservice.models import Bot, BotProperties, Sku45from azure.identity import DefaultAzureCredential46import os4748credential = DefaultAzureCredential()49client = AzureBotService(50 credential=credential,51 subscription_id=os.environ["AZURE_SUBSCRIPTION_ID"]52)5354resource_group = os.environ["AZURE_RESOURCE_GROUP"]55bot_name = "my-chat-bot"5657bot = client.bots.create(58 resource_group_name=resource_group,59 resource_name=bot_name,60 parameters=Bot(61 location="global",62 sku=Sku(name="F0"), # Free tier63 kind="azurebot",64 properties=BotProperties(65 display_name="My Chat Bot",66 description="A conversational AI bot",67 endpoint="https://my-bot-app.azurewebsites.net/api/messages",68 msa_app_id="<your-app-id>",69 msa_app_type="MultiTenant"70 )71 )72)7374print(f"Bot created: {bot.name}")75```7677## Get Bot Details7879```python80bot = client.bots.get(81 resource_group_name=resource_group,82 resource_name=bot_name83)8485print(f"Bot: {bot.properties.display_name}")86print(f"Endpoint: {bot.properties.endpoint}")87print(f"SKU: {bot.sku.name}")88```8990## List Bots in Resource Group9192```python93bots = client.bots.list_by_resource_group(resource_group_name=resource_group)9495for bot in bots:96 print(f"Bot: {bot.name} - {bot.properties.display_name}")97```9899## List All Bots in Subscription100101```python102all_bots = client.bots.list()103104for bot in all_bots:105 print(f"Bot: {bot.name} in {bot.id.split('/')[4]}")106```107108## Update Bot109110```python111bot = client.bots.update(112 resource_group_name=resource_group,113 resource_name=bot_name,114 properties=BotProperties(115 display_name="Updated Bot Name",116 description="Updated description"117 )118)119```120121## Delete Bot122123```python124client.bots.delete(125 resource_group_name=resource_group,126 resource_name=bot_name127)128```129130## Configure Channels131132### Add Teams Channel133134```python135from azure.mgmt.botservice.models import (136 BotChannel,137 MsTeamsChannel,138 MsTeamsChannelProperties139)140141channel = client.channels.create(142 resource_group_name=resource_group,143 resource_name=bot_name,144 channel_name="MsTeamsChannel",145 parameters=BotChannel(146 location="global",147 properties=MsTeamsChannel(148 properties=MsTeamsChannelProperties(149 is_enabled=True150 )151 )152 )153)154```155156### Add Direct Line Channel157158```python159from azure.mgmt.botservice.models import (160 BotChannel,161 DirectLineChannel,162 DirectLineChannelProperties,163 DirectLineSite164)165166channel = client.channels.create(167 resource_group_name=resource_group,168 resource_name=bot_name,169 channel_name="DirectLineChannel",170 parameters=BotChannel(171 location="global",172 properties=DirectLineChannel(173 properties=DirectLineChannelProperties(174 sites=[175 DirectLineSite(176 site_name="Default Site",177 is_enabled=True,178 is_v1_enabled=False,179 is_v3_enabled=True180 )181 ]182 )183 )184 )185)186```187188### Add Web Chat Channel189190```python191from azure.mgmt.botservice.models import (192 BotChannel,193 WebChatChannel,194 WebChatChannelProperties,195 WebChatSite196)197198channel = client.channels.create(199 resource_group_name=resource_group,200 resource_name=bot_name,201 channel_name="WebChatChannel",202 parameters=BotChannel(203 location="global",204 properties=WebChatChannel(205 properties=WebChatChannelProperties(206 sites=[207 WebChatSite(208 site_name="Default Site",209 is_enabled=True210 )211 ]212 )213 )214 )215)216```217218## Get Channel Details219220```python221channel = client.channels.get(222 resource_group_name=resource_group,223 resource_name=bot_name,224 channel_name="DirectLineChannel"225)226```227228## List Channel Keys229230```python231keys = client.channels.list_with_keys(232 resource_group_name=resource_group,233 resource_name=bot_name,234 channel_name="DirectLineChannel"235)236237# Access Direct Line keys238if hasattr(keys.properties, 'properties'):239 for site in keys.properties.properties.sites:240 print(f"Site: {site.site_name}")241 print(f"Key: {site.key}")242```243244## Bot Connections (OAuth)245246### Create Connection Setting247248```python249from azure.mgmt.botservice.models import (250 ConnectionSetting,251 ConnectionSettingProperties252)253254connection = client.bot_connection.create(255 resource_group_name=resource_group,256 resource_name=bot_name,257 connection_name="graph-connection",258 parameters=ConnectionSetting(259 location="global",260 properties=ConnectionSettingProperties(261 client_id="<oauth-client-id>",262 client_secret="<oauth-client-secret>",263 scopes="User.Read",264 service_provider_id="<service-provider-id>"265 )266 )267)268```269270### List Connections271272```python273connections = client.bot_connection.list_by_bot_service(274 resource_group_name=resource_group,275 resource_name=bot_name276)277278for conn in connections:279 print(f"Connection: {conn.name}")280```281282## Client Operations283284| Operation | Method |285|-----------|--------|286| `client.bots` | Bot CRUD operations |287| `client.channels` | Channel configuration |288| `client.bot_connection` | OAuth connection settings |289| `client.direct_line` | Direct Line channel operations |290| `client.email` | Email channel operations |291| `client.operations` | Available operations |292| `client.host_settings` | Host settings operations |293294## SKU Options295296| SKU | Description |297|-----|-------------|298| `F0` | Free tier (limited messages) |299| `S1` | Standard tier (unlimited messages) |300301## Channel Types302303| Channel | Class | Purpose |304|---------|-------|---------|305| `MsTeamsChannel` | Microsoft Teams | Teams integration |306| `DirectLineChannel` | Direct Line | Custom client integration |307| `WebChatChannel` | Web Chat | Embeddable web widget |308| `SlackChannel` | Slack | Slack workspace integration |309| `FacebookChannel` | Facebook | Messenger integration |310| `EmailChannel` | Email | Email communication |311312## Best Practices3133141. **Use DefaultAzureCredential** for authentication3152. **Start with F0 SKU** for development, upgrade to S1 for production3163. **Store MSA App ID/Secret securely** — use Key Vault3174. **Enable only needed channels** — reduces attack surface3185. **Rotate Direct Line keys** periodically3196. **Use managed identity** when possible for bot connections3207. **Configure proper CORS** for Web Chat channel321
Full transparency — inspect the skill content before installing.