|  | 
|  | 1 | +--- | 
|  | 2 | +title: Deploy Bots to Microsoft Azure operated by 21Vianet | 
|  | 3 | +description: Learn how to configure a bot to operate in the Microsoft Azure operated by 21Vianet. | 
|  | 4 | +author: singhvikra-micro | 
|  | 5 | +ms.author: singhvikra | 
|  | 6 | +manager: kunsingh | 
|  | 7 | +ms.reviewer: kparihar | 
|  | 8 | +ms.service: azure-ai-bot-service | 
|  | 9 | +ms.topic: how-to | 
|  | 10 | +ms.date: 09/23/2024 | 
|  | 11 | +ms.custom: | 
|  | 12 | +  - template-how-to | 
|  | 13 | +  - evergreen | 
|  | 14 | +--- | 
|  | 15 | + | 
|  | 16 | +# Configure a bot in Microsoft Azure operated by 21Vianet | 
|  | 17 | + | 
|  | 18 | +This guide helps Microsoft Azure customers deploy Bot Framework and Azure AI Bot Service bots on the Microsoft Azure platform operated by 21Vianet. | 
|  | 19 | + | 
|  | 20 | +## Prerequisites | 
|  | 21 | + | 
|  | 22 | +- An account in the Microsoft Azure. | 
|  | 23 | +- The C# or JavaScript bot project you want to configure. | 
|  | 24 | +- Bot Framework SDK version 4.14 or later. | 
|  | 25 | + | 
|  | 26 | +## Use the cloud adapter | 
|  | 27 | + | 
|  | 28 | +Make sure that your bot uses the _cloud adapter_, or an adapter that derives from the cloud adapter. | 
|  | 29 | +The cloud adapter lets you specify settings specific to the Microsoft Azure Cloud. | 
|  | 30 | + | 
|  | 31 | +### [C#](#tab/csharp) | 
|  | 32 | + | 
|  | 33 | +The `ConfigurationBotFrameworkAuthentication` class reads authentication settings from your bot configuration file. Upon creation, the cloud adapter utilizes these authentication settings. | 
|  | 34 | + | 
|  | 35 | +Make sure that the `ConfigureServices` method in your **Startup.cs** file contains this line. | 
|  | 36 | + | 
|  | 37 | +```csharp | 
|  | 38 | +services.AddSingleton<BotFrameworkAuthentication, ConfigurationBotFrameworkAuthentication>(); | 
|  | 39 | +``` | 
|  | 40 | + | 
|  | 41 | +### [JavaScript](#tab/javascript) | 
|  | 42 | + | 
|  | 43 | +The `ConfigurationBotFrameworkAuthentication` constructor reads authentication settings from your bot configuration file. | 
|  | 44 | + | 
|  | 45 | +In your **index.js** file, the code to create your adapter should look like this: | 
|  | 46 | + | 
|  | 47 | +```javascript | 
|  | 48 | +const botFrameworkAuthentication = new ConfigurationBotFrameworkAuthentication(process.env); | 
|  | 49 | + | 
|  | 50 | +const adapter = new CloudAdapter(botFrameworkAuthentication); | 
|  | 51 | +``` | 
|  | 52 | + | 
|  | 53 | +--- | 
|  | 54 | + | 
|  | 55 | +## Configure UserAssignedMSI/SingleTenant Bot | 
|  | 56 | + | 
|  | 57 | +To ensure the bot functions correctly in the Microsoft Azure Cloud, extra authentication settings are necessary. Replace the "App-Tenant-ID" with the bot's tenant ID. | 
|  | 58 | + | 
|  | 59 | +### [C#](#tab/csharp) | 
|  | 60 | + | 
|  | 61 | +Add the following settings to your **appsettings.json** file. | 
|  | 62 | + | 
|  | 63 | +```json | 
|  | 64 | +"OAuthUrl": "https://token.botframework.azure.cn/",  | 
|  | 65 | +"ToChannelFromBotLoginUrl": "https://login.partner.microsoftonline.cn/<App-Tenant-ID>", | 
|  | 66 | +"ToChannelFromBotOAuthScope": "https://api.botframework.azure.cn", | 
|  | 67 | +"ToBotFromChannelTokenIssuer": "https://api.botframework.azure.cn", | 
|  | 68 | +"ToBotFromChannelOpenIdMetadataUrl": "https://login.botframework.azure.cn/v1/.well-known/openidconfiguration", | 
|  | 69 | +"ToBotFromEmulatorOpenIdMetadataUrl": "https://login.partner.microsoftonline.cn/a55a4d5b-9241-49b1-b4ff-befa8db00269/v2.0/.well-known/openid-configuration", | 
|  | 70 | +"ValidateAuthority": true | 
|  | 71 | +``` | 
|  | 72 | + | 
|  | 73 | +### [JavaScript](#tab/javascript) | 
|  | 74 | + | 
|  | 75 | +Add the following settings to your **.env** file. | 
|  | 76 | + | 
|  | 77 | +```ini | 
|  | 78 | +OAuthUrl=https://token.botframework.azure.cn/,  | 
|  | 79 | +ToChannelFromBotLoginUrl=https://login.partner.microsoftonline.cn/<App-Tenant-Id>, | 
|  | 80 | +ToChannelFromBotOAuthScope=https://api.botframework.azure.cn, | 
|  | 81 | +ToBotFromChannelTokenIssuer=https://api.botframework.azure.cn, | 
|  | 82 | +ToBotFromChannelOpenIdMetadataUrl=https://login.botframework.azure.cn/v1/.well-known/openidconfiguration, | 
|  | 83 | +ToBotFromEmulatorOpenIdMetadataUrl=https://login.partner.microsoftonline.cn/a55a4d5b-9241-49b1-b4ff-befa8db00269/v2.0/.well-known/openid-configuration, | 
|  | 84 | +ValidateAuthority=true | 
|  | 85 | +``` | 
|  | 86 | + | 
|  | 87 | +--- | 
|  | 88 | + | 
|  | 89 | +## Configure MultiTenant Bot | 
|  | 90 | + | 
|  | 91 | +For the multitenant bot, use the following settings. | 
|  | 92 | + | 
|  | 93 | +### [C#](#tab/csharp) | 
|  | 94 | + | 
|  | 95 | +Add the following settings to your **appsettings.json** file. | 
|  | 96 | + | 
|  | 97 | +```json | 
|  | 98 | +"OAuthUrl": "https://token.botframework.azure.cn/",  | 
|  | 99 | +"ToChannelFromBotLoginUrl": "https://login.partner.microsoftonline.cn/microsoftservices.partner.onmschina.cn", | 
|  | 100 | +"ToChannelFromBotOAuthScope": "https://api.botframework.azure.cn", | 
|  | 101 | +"ToBotFromChannelTokenIssuer": "https://api.botframework.azure.cn", | 
|  | 102 | +"ToBotFromChannelOpenIdMetadataUrl": "https://login.botframework.azure.cn/v1/.well-known/openidconfiguration", | 
|  | 103 | +"ToBotFromEmulatorOpenIdMetadataUrl": "https://login.partner.microsoftonline.cn/a55a4d5b-9241-49b1-b4ff-befa8db00269/v2.0/.well-known/openid-configuration", | 
|  | 104 | +"ValidateAuthority": true | 
|  | 105 | +``` | 
|  | 106 | + | 
|  | 107 | +### [JavaScript](#tab/javascript) | 
|  | 108 | + | 
|  | 109 | +Add the following settings to your **.env** file. | 
|  | 110 | + | 
|  | 111 | +```ini | 
|  | 112 | +OAuthUrl=https://token.botframework.azure.cn/,  | 
|  | 113 | +ToChannelFromBotLoginUrl=https://login.partner.microsoftonline.cn/microsoftservices.partner.onmschina.cn, | 
|  | 114 | +ToChannelFromBotOAuthScope=https://api.botframework.azure.cn, | 
|  | 115 | +ToBotFromChannelTokenIssuer=https://api.botframework.azure.cn, | 
|  | 116 | +ToBotFromChannelOpenIdMetadataUrl=https://login.botframework.azure.cn/v1/.well-known/openidconfiguration, | 
|  | 117 | +ToBotFromEmulatorOpenIdMetadataUrl=https://login.partner.microsoftonline.cn/a55a4d5b-9241-49b1-b4ff-befa8db00269/v2.0/.well-known/openid-configuration, | 
|  | 118 | +ValidateAuthority=true | 
|  | 119 | +``` | 
|  | 120 | + | 
|  | 121 | +---  | 
|  | 122 | + | 
|  | 123 | +## Add user authentication to your bot | 
|  | 124 | + | 
|  | 125 | +Your bot can use various identity providers to access resources on behalf of a user, such as Microsoft Entra ID and many other OAuth providers. | 
|  | 126 | + | 
|  | 127 | +The Microsoft Azure Cloud uses a redirect URL that is different from the ones used for other environments. | 
|  | 128 | +To configuring your bot for authentication, use `https://token.botframework.azure.cn/.auth/web/redirect` as the OAuth redirect URL and follow the steps in how to [add authentication to your bot](v4sdk/bot-builder-authentication.md). | 
|  | 129 | + | 
|  | 130 | +--- | 
|  | 131 | + | 
|  | 132 | +## Configure a bot to run on one or more channels | 
|  | 133 | + | 
|  | 134 | +To configure a bot to connect to a channel, complete the following steps: | 
|  | 135 | + | 
|  | 136 | +1. Sign in to the [Azure portal](https://portal.azure.cn). | 
|  | 137 | +2. Select the bot that you want to configure. | 
|  | 138 | +3. In the left pane, select **Channels** under **Settings**. | 
|  | 139 | +4. In the right pane, select the icon of the channel you want to add to your bot. You may need to scroll down to see the list of all **Available Channels**. The connection steps vary for each channel. For more information on supported channels, see the related articles. | 
|  | 140 | + | 
|  | 141 | +| Channel | Description | | 
|  | 142 | +|:-|:-| | 
|  | 143 | +| [Direct Line](bot-service-channel-directline.md) | Integrate a bot into a mobile app, web page, or other applications. | | 
|  | 144 | +| [Microsoft Teams](channel-connect-teams.md) | Configure a bot to communicate with users through Microsoft Teams. | | 
|  | 145 | +| [Web Chat](bot-service-channel-connect-webchat.md) | Automatically configured for you when you create a bot with the Bot Framework Service. | | 
|  | 146 | + | 
|  | 147 | +--- | 
|  | 148 | + | 
|  | 149 | +## Next steps | 
|  | 150 | + | 
|  | 151 | +With these steps, your bot should be configured to work successfully. Other useful references regarding Bot Service. | 
|  | 152 | + | 
|  | 153 | +- [Tutorial: Deploy a basic bot using Azure AI Bot Service](tutorial-publish-a-bot.md) | 
|  | 154 | +- [Add authentication to a bot in Bot Framework SDK](v4sdk/bot-builder-authentication.md) | 
|  | 155 | +- [Connect a bot to Web Chat in the Bot Framework SDK](bot-service-channel-connect-webchat.md) | 
|  | 156 | +- [Authenticate requests with the Bot Connector API](rest-api/bot-framework-rest-connector-authentication.md) | 
|  | 157 | +- [Compliance in the Azure AI Bot Service](bot-service-compliance.md) | 
0 commit comments