Skip to content

Commit 53a36af

Browse files
authored
Release 'live' 4-1-19 (MicrosoftDocs#1398)
1 parent 1527607 commit 53a36af

File tree

4 files changed

+173
-86
lines changed

4 files changed

+173
-86
lines changed

articles/TOC.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
## [Managing state](v4sdk/bot-builder-concept-state.md)
1919
## [Dialogs library](v4sdk/bot-builder-concept-dialog.md)
2020
## [Middleware](v4sdk/bot-builder-concept-middleware.md)
21-
## [Manage resources with a .bot file](v4sdk/bot-file-basics.md)
21+
## [Manage bot resources](v4sdk/bot-file-basics.md)
2222
<!-- [Language understanding](v4sdk/bot-builder-concept-luis.md) -->
2323
## [Bot Service templates](bot-service-concept-templates.md)
2424
## [Cognitive Services](bot-service-concept-intelligence.md)

articles/bot-builder-deploy-az-cli.md

Lines changed: 34 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: kamrani
88
ms.topic: get-started-article
99
ms.service: bot-service
1010
ms.subservice: abs
11-
ms.date: 02/13/2019
11+
ms.date: 03/30/2019
1212
---
1313

1414
# Deploy your bot
@@ -34,7 +34,7 @@ The deployment process requires a target Web App Bot in Azure so that your local
3434
During the creation of the target Web App Bot, an app ID and password are also generated for your bot. In Azure, the app ID and password support [service authentication and authorization](https://docs.microsoft.com/azure/app-service/overview-authentication-authorization). You will retrieve some of this information for use in your local bot code.
3535

3636
> [!IMPORTANT]
37-
> The language for the bot template for the service must match the language your bot is written in.
37+
> The programming language for the bot template used in the Azure portal must match the programming language your bot is written in.
3838
3939
Creating a new Web App Bot is optional if you have already created a bot in Azure that you'd like to use.
4040

@@ -45,92 +45,49 @@ Creating a new Web App Bot is optional if you have already created a bot in Azur
4545
1. Click **Create** to create the service and deploy the bot to the cloud. This process may take several minutes.
4646

4747
### Download the source code
48-
After creating the target Web App Bot, you need to download the bot code from the Azure portal to your local machine. The reason for downloading code is to get the service references that are in the [.bot file](./v4sdk/bot-file-basics.md). These service reference are for Web App Bot, App Service Plan, App Service, and Storage Account.
48+
After creating the target Web App Bot, you need to download the bot code from the Azure portal to your local machine. The reason for downloading code is to get the service references (e.g. MicrosoftAppID, MicrosoftAppPassword, LUIS, or QnA) that are in the appsettings.json or .env file.
4949

5050
1. In the **Bot Management** section, click **Build**.
5151
1. Click on **Download Bot source code** link in the right-pane.
5252
1. Follow the prompts to download the code, and then unzip the folder.
5353
1. [!INCLUDE [download keys snippet](~/includes/snippet-abs-key-download.md)]
5454

55-
### Decrypt the .bot file
55+
### Update your local appsettings.json or .env file
5656

57-
The source code you downloaded from the Azure portal includes an encrypted .bot file. You'll need to decrypt it to copy values into your local .bot file. This step is necessary so that you can copy actual service references and not the encrypted ones.
57+
Open the appsettings.json or .env file you downloaded. Copy **all** entries listed in it and add them to your _local_ appsettings.json or .env file. Resolve any duplicate service entries or duplicate service IDs. Keep any additional service references your bot depends on.
5858

59-
1. In the Azure portal, open the Web App Bot resource for your bot.
60-
1. Open the bot's **Application Settings**.
61-
1. In the **Application Settings** window, scroll down to **Application settings**.
62-
1. Locate the **botFileSecret** and copy its value.
63-
1. Use `msbot cli` to decrypt the file.
64-
65-
```cmd
66-
msbot secret --bot <name-of-bot-file> --secret "<bot-file-secret>" --clear
67-
```
68-
69-
### Update your local .bot file
70-
71-
Open the .bot file you decrypted. Copy **all** entries listed under the `services` section, and add them to your local .bot file. Resolve any duplicate service entries or duplicate service IDs. Keep any additional service references your bot depends on. For example:
72-
73-
```json
74-
"services": [
75-
{
76-
"type": "abs",
77-
"tenantId": "<tenant-id>",
78-
"subscriptionId": "<subscription-id>",
79-
"resourceGroup": "<resource-group-name>",
80-
"serviceName": "<bot-service-name>",
81-
"name": "<friendly-service-name>",
82-
"id": "1",
83-
"appId": "<app-id>"
84-
},
85-
{
86-
"type": "blob",
87-
"connectionString": "<connection-string>",
88-
"tenantId": "<tenant-id>",
89-
"subscriptionId": "<subscription-id>",
90-
"resourceGroup": "<resource-group-name>",
91-
"serviceName": "<blob-service-name>",
92-
"id": "2"
93-
},
94-
{
95-
"type": "endpoint",
96-
"appId": "",
97-
"appPassword": "",
98-
"endpoint": "<local-endpoint-url>",
99-
"name": "development",
100-
"id": "3"
101-
},
102-
{
103-
"type": "endpoint",
104-
"appId": "<app-id>",
105-
"appPassword": "<app-password>",
106-
"endpoint": "<hosted-endpoint-url>",
107-
"name": "production",
108-
"id": "4"
109-
},
110-
{
111-
"type": "appInsights",
112-
"instrumentationKey": "<instrumentation-key>",
113-
"applicationId": "<appinsights-app-id>",
114-
"apiKeys": {},
115-
"tenantId": "<tenant-id>",
116-
"subscriptionId": "<subscription-id>",
117-
"resourceGroup": "<resource-group>",
118-
"serviceName": "<appinsights-service-name>",
119-
"id": "5"
120-
}
121-
],
59+
Save the file.
60+
61+
### Update local bot code
62+
Update the local Startup.cs or index.js file to use appsettings.json or .env file instead using the .bot file. The .bot file has been deprecated and we are working on updating VSIX templates, Yeoman generators, samples, and remaining docs to all use appsettings.json or .env file instead of the .bot file. In the meantime, you'll need to make changes to the bot code.
63+
64+
Update the code to read settings from appsettings.json or .env file.
65+
66+
# [C#](#tab/csharp)
67+
In the `ConfigureServices` method, use the configuration object that ASP.NET Core provides, for example:
68+
69+
**Startup.cs**
70+
```csharp
71+
var appId = Configuration.GetSection("MicrosoftAppId").Value;
72+
var appPassword = Configuration.GetSection("MicrosoftAppPassword").Value;
73+
options.CredentialProvider = new SimpleCredentialProvider(appId, appPassword);
12274
```
12375

124-
Save the file.
76+
# [JS](#tab/js)
12577

126-
You can use the msbot tool to generate a new secret and encrypt the .bot file before you publish. If you re-encrypt your .bot file, update the bot's **botFileSecret** in the Azure portal to contain the new secret.
78+
In JavaScript, reference .env variables off of the `process.env` object, for example:
79+
80+
**index.js**
12781

128-
```cmd
129-
msbot secret --bot <name-of-bot-file> --new
82+
```js
83+
const adapter = new BotFrameworkAdapter({
84+
appId: process.env.MicrosoftAppId,
85+
appPassword: process.env.MicrosoftAppPassword
86+
});
13087
```
88+
---
13189

132-
> [!TIP]
133-
> In the file properties for your .bot file, inside Visual Studio, make sure the **Copy to Output Directory** is set to *Copy always*.
90+
- Save the file and test your bot.
13491

13592
### Setup a repository
13693

@@ -139,13 +96,12 @@ To support continuous deployment, create a git repository using your favorite gi
13996
Make sure that your repository root has the correct files, as described under [prepare your repository](https://docs.microsoft.com/azure/app-service/deploy-continuous-deployment#prepare-your-repository).
14097

14198
### Update App Settings in Azure
142-
The local bot does not use an encrypted .bot file, but the Azure portal is configured to use an encrypted .bot file. You can resolve this by removing the **botFileSecret** stored in the Azure bot settings.
99+
The local bot does not use an encrypted .bot file, but _if_ the Azure portal is configured to use an encrypted .bot file. You can resolve this by removing the **botFileSecret** stored in the Azure bot settings.
143100
1. In the Azure portal, open the **Web App Bot** resource for your bot.
144101
1. Open the bot's **Application Settings**.
145102
1. In the **Application Settings** window, scroll down to **Application settings**.
146-
1. Locate the **botFileSecret** and delete it. (If you re-encrypted your .bot file, make sure the **botFileSecret** contains the new secret and **do not** delete the setting.)
147-
1. Update the name of the bot file to match the file you checked into the repo.
148-
1. Save changes.
103+
1. Check to see if your bot has **botFileSecret** and **botFilePath** entries. If you do, delete it.
104+
1. Save the changes.
149105

150106
## 2. Deploy using Azure Deployment Center
151107

articles/bot-service-quickstart.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ You can download the code to work on it locally.
130130
1. Follow the prompts to download the code, and then unzip the folder.
131131
1. [!INCLUDE [download keys snippet](~/includes/snippet-abs-key-download.md)]
132132

133-
The code you downloaded uses an encrypted [.bot file](./v4sdk/bot-file-basics.md). You'll need to update `botFilePath` and `botFileSecret` entires in the appsettings.json or .env file.
134-
To do that, go to the Azure portal. Select your bot in the portal, then under **App Service Settings** section, click **Application Settings**. In the **Application Settings** pane, you'll
135-
see `botFilePath` and `botFileSecret` values. Copy these values and update the .env or appsettings.json file.
136-
137133
## Next steps
138134
After you download the code, you can continue to develop the bot locally on your machine. Once you test your bot and are ready to upload the bot code to the Azure portal, follow the instructions listed under [Setting up a repo](./bot-builder-deploy-az-cli.md#setup-a-repository) section of the deployment topic.
139135

articles/v4sdk/bot-file-basics.md

Lines changed: 138 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,149 @@
11
---
22
title: Manage resources with a .bot file | Microsoft Docs
33
description: Describes the purpose and use of bot file.
4-
keywords: bot file, .bot, .bot file, msbot, bot resources, manage bot resources
4+
keywords: bot file, .bot, .bot file, bot resources, manage bot resources
55
author: ivorb
66
ms.author: v-ivorb
77
manager: kamrani
88
ms.topic: article
99
ms.service: bot-service
10-
ms.subservice: sdk
11-
ms.date: 03/11/2018
10+
ms.date: 03/30/2019
1211
monikerRange: 'azure-bot-service-4.0'
1312
---
1413

14+
# Manage bot resources
15+
16+
Bots usually consume different services, such as [LUIS.ai](https://luis.ai) or [QnaMaker.ai](https://qnamaker.ai). When you are developing a bot, you need to be able to keep track of them all. You can use various methods such as appsettings.json, web.config, or .env.
17+
18+
> [!IMPORTANT]
19+
> Prior to the Bot Framework SDK 4.3 release, we offered the .bot file as a mechanism to manage resources. However, going forward we recommend that you use appsettings.json or .env file for managing these resources. Bots that use .bot file will continue to work for now even though the .bot file has been **_deprecated_**. If you've been using a .bot file to manage resources, follow the steps that apply to migrate the settings.
20+
21+
## Migrating settings from .bot file
22+
The following sections cover how to migrate settings from the .bot file. Follow the scenario that applies to you.
23+
24+
**Scenario 1: Local bot that has a .bot file**
25+
26+
In this scenario you have a local bot that uses a .bot file, but the _bot has not been migrated_ to the Azure portal. Follow the steps below to migrate settings from the .bot file to appsettings.json or .env file.
27+
28+
- If the .bot file is encrypted, you'll need to decrypt it using the following command:
29+
30+
```cli
31+
msbot secret --bot <name-of-bot-file> --secret "<bot-file-secret>" --clear` command.
32+
```
33+
34+
- Open the decrypted .bot file, copy the values and add them to the appsettings.json or .env file.
35+
- Update the code to read settings from appsettings.json or .env file.
36+
37+
# [C#](#tab/csharp)
38+
39+
In the `ConfigureServices` method, use the configuration object that ASP.NET Core provides, for example:
40+
41+
**Startup.cs**
42+
```csharp
43+
var appId = Configuration.GetSection("MicrosoftAppId").Value;
44+
var appPassword = Configuration.GetSection("MicrosoftAppPassword").Value;
45+
options.CredentialProvider = new SimpleCredentialProvider(appId, appPassword);
46+
```
47+
# [JavaScript](#tab/js)
48+
49+
In JavaScript, reference .env variables off of the `process.env` object, for example:
50+
51+
**index.js**
52+
53+
```js
54+
const adapter = new BotFrameworkAdapter({
55+
appId: process.env.MicrosoftAppId,
56+
appPassword: process.env.MicrosoftAppPassword
57+
});
58+
```
59+
---
60+
61+
If needed, provision resources and connect them to your bot using the appsettings.json or .env file.
62+
63+
**Scenario #2: Bot deployed to Azure with a .bot file**
64+
65+
In this scenario you have already deployed a bot to the Azure portal using the .bot file, and now you want to migrate settings from the .bot file to appsettings.json or .env file.
66+
67+
- Download the bot code from the Azure portal. When you download the code, you'll be prompted to include appsettings.json or .env file that will have your MicrosoftAppId and MicrosoftAppPassword and any additional settings in it.
68+
- Open the _downloaded_ appsettings.json or .env file, and copy the settings from it into your _local_ appsettings.json or .env file. Don't forget to remove the botSecret and botFilePath entries from your local appsettings.json or .env file.
69+
- Update the code to read settings from appsettings.json or .env file.
70+
71+
# [C#](#tab/csharp)
72+
In the `ConfigureServices` method, use the configuration object that ASP.NET Core provides, for example:
73+
74+
**Startup.cs**
75+
```csharp
76+
var appId = Configuration.GetSection("MicrosoftAppId").Value;
77+
var appPassword = Configuration.GetSection("MicrosoftAppPassword").Value;
78+
options.CredentialProvider = new SimpleCredentialProvider(appId, appPassword);
79+
```
80+
# [JavaScript](#tab/js)
81+
In JavaScript, reference .env variables off of the `process.env` object, for example:
82+
83+
**index.js**
84+
85+
```js
86+
const adapter = new BotFrameworkAdapter({
87+
appId: process.env.MicrosoftAppId,
88+
appPassword: process.env.MicrosoftAppPassword
89+
});
90+
```
91+
---
92+
93+
You’ll also need to remove the `botFilePath` and `botFileSecret` from the **Application Settings** section in the **Azure portal**.
94+
95+
_If needed_, provision resources and connect them to your bot using the appsettings.json or .env file.
96+
97+
**Scenario #3: For bots that use appsettings.json or .env file**
98+
99+
This scenario covers the case in which you are starting to develop bots using SDK 4.3 from scratch and don't have existing .bot files to migrate. All settings that you want to use in your bot are in the appsettings.json or .env file as shown below:
100+
101+
```JSON
102+
{
103+
"MicrosoftAppId": "<your-AppId>",
104+
"MicrosoftAppPassword": "<your-AppPwd>"
105+
}
106+
```
107+
108+
# [C#](#tab/csharp)
109+
110+
To read the above settings in your C# code, you'll use the configuration object that ASP.,NET Core provides for example:
111+
**Startup.cs**
112+
```csharp
113+
var appId = Configuration.GetSection("MicrosoftAppId").Value;
114+
var appPassword = Configuration.GetSection("MicrosoftAppPassword").Value;
115+
options.CredentialProvider = new SimpleCredentialProvider(appId, appPassword);
116+
```
117+
118+
# [JavaScript](#tab/js)
119+
In JavaScript, reference .env variables off of the `process.env` object for example:
120+
**index.js**
121+
```js
122+
const adapter = new BotFrameworkAdapter({
123+
appId: process.env.MicrosoftAppId,
124+
appPassword: process.env.MicrosoftAppPassword
125+
});
126+
```
127+
128+
If needed, provision resources and connect them to your bot using the appsettings.json or .env file.
129+
130+
131+
## FAQ
132+
**Q:** I want to create a new V4 bot in Azure portal. How has the Azure portal experience changed with the removal of the .bot file?
133+
134+
**A:** When you create a bot in the Azure portal, .bot file will not be created. You can use the **Application Settings** section in the **Azure portal** to find IDs/Keys. When you download the code, these settings will be stored in the appsettings.json or .env file for you. In your bot, you can update the code to read the settings before making the call to the individual service. After you’ve updated your bot code, you can use az bot publish to deploy your bot.
135+
136+
**Q:** What about V3 bots?
137+
138+
**A:** The scenario for V3 bot is similar to the scenario for V4 bots without a bot file. The deployment process will continue to work.
139+
140+
## Additional resources
141+
- For steps to deploy the bot, see [deployment](../bot-builder-deploy-az-cli.md) topic.
142+
- To protect keys and secrets, we recommend you use Azure Key Vault. Azure Key Vault is a tool for securely storing and accessing secrets, such as your bot's endpoint and authoring keys. It provides a [Key Management](https://docs.microsoft.com/en-us/azure/key-vault/key-vault-whatis) solution and makes it easy to create and control your encryption keys, so you have tight control over your secrets.
143+
144+
145+
<!--
146+
15147
# Manage resources with a .bot file
16148
17149
Bots usually consume lots of different services, such as [LUIS.ai](https://luis.ai) or [QnaMaker.ai](https://qnamaker.ai). When you are developing a bot, there is no uniform place to store the metadata about the services that are in use. This prevents us from building tooling that looks at a bot as a whole.
@@ -62,3 +194,6 @@ for [C#](https://www.nuget.org/packages/Microsoft.Bot.Configuration) and [JS](ht
62194
63195
## Additional resources
64196
Refer to [MSBot](https://github.com/Microsoft/botbuilder-tools/blob/master/packages/MSBot/README.md) readme file for more information on using a bot file.
197+
198+
-->
199+

0 commit comments

Comments
 (0)