Skip to content

Commit cb2e607

Browse files
Pavan-MicrosoftRoopan-MicrosoftAjitPadhi-Microsoftross-p-smithgpickett
authored
fix: Improve Deployment Docs, Single-Tenant Teams Extension, and Ingestion Error Handling (#1915)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Roopan-Microsoft <[email protected]> Co-authored-by: Ajit Padhi <[email protected]> Co-authored-by: Roopan P M <[email protected]> Co-authored-by: Ross Smith <[email protected]> Co-authored-by: gpickett <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Prajwal D C <[email protected]> Co-authored-by: Harmanpreet-Microsoft <[email protected]> Co-authored-by: UtkarshMishra-Microsoft <[email protected]> Co-authored-by: Priyanka-Microsoft <[email protected]> Co-authored-by: Prasanjeet-Microsoft <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kiran-Siluveru-Microsoft <[email protected]> Co-authored-by: Prashant-Microsoft <[email protected]> Co-authored-by: Rohini-Microsoft <[email protected]> Co-authored-by: Avijit-Microsoft <[email protected]> Co-authored-by: RaviKiran-Microsoft <[email protected]> Co-authored-by: Somesh Joshi <[email protected]> Co-authored-by: Himanshi Agrawal <[email protected]> Co-authored-by: pradeepjha-microsoft <[email protected]> Co-authored-by: Harmanpreet Kaur <[email protected]> Co-authored-by: Bangarraju-Microsoft <[email protected]> Co-authored-by: Harsh-Microsoft <[email protected]> Co-authored-by: Kanchan-Microsoft <[email protected]> Co-authored-by: Cristopher Coronado <[email protected]> Co-authored-by: Cristopher Coronado Moreira <[email protected]> Co-authored-by: Vamshi-Microsoft <[email protected]> Co-authored-by: Thanusree-Microsoft <[email protected]> Co-authored-by: Niraj Chaudhari (Persistent Systems Inc) <[email protected]> Co-authored-by: Rohini-Microsoft <[email protected]>
1 parent aa5bd5c commit cb2e607

File tree

17 files changed

+300
-61
lines changed

17 files changed

+300
-61
lines changed

.github/workflows/group_dependabot_security_updates.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ jobs:
6565
git config --global user.email "[email protected]"
6666
6767
- name: Install required tools
68-
uses: awalsh128/[email protected]
69-
with:
70-
packages: "jq gh"
68+
run: |
69+
sudo apt-get update
70+
sudo apt-get install -y jq gh
71+
shell: bash
7172

7273
- name: Enable strict error handling
7374
shell: bash

code/backend/pages/01_Ingest_Data.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ def reprocess_all():
5555

5656
def add_urls():
5757
urls = st.session_state["urls"].split("\n")
58-
add_url_embeddings(urls)
58+
result = add_url_embeddings(urls)
59+
# If URLs are valid and processed, clear the textarea
60+
if result:
61+
st.session_state["urls"] = ""
5962

6063

6164
def sanitize_metadata_value(value):
@@ -67,7 +70,7 @@ def add_url_embeddings(urls: list[str]):
6770
has_valid_url = bool(list(filter(str.strip, urls)))
6871
if not has_valid_url:
6972
st.error("Please enter at least one valid URL.")
70-
return
73+
return False
7174

7275
params = {}
7376
if env_helper.FUNCTION_KEY is not None:
@@ -80,9 +83,11 @@ def add_url_embeddings(urls: list[str]):
8083
)
8184
r = requests.post(url=backend_url, params=params, json=body)
8285
if not r.ok:
83-
raise ValueError(f"Error {r.status_code}: {r.text}")
86+
st.error(f"Error {r.status_code}: {r.text}")
87+
return False
8488
else:
8589
st.success(f"Embeddings added successfully for {url}")
90+
return True
8691

8792

8893
try:

docs/LOCAL_DEPLOYMENT.md

Lines changed: 110 additions & 37 deletions
Large diffs are not rendered by default.

docs/teams_extension.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This extension enables users to experience Chat with your data within Teams, wit
1616
### Pre-requisites
1717
- [Visual Studio Code](https://code.visualstudio.com/)
1818
- Extensions
19-
- [Teams Toolkit](https://marketplace.visualstudio.com/items?itemName=TeamsDevApp.ms-teams-vscode-extension) (optional: Teams extension only)
19+
- [Microsoft 365 Agents Toolkit](https://marketplace.visualstudio.com/items?itemName=TeamsDevApp.ms-teams-vscode-extension) (optional: Teams extension only)
2020
- Install [Node.js](https://nodejs.org/en)
2121
- Install the LTS version (Recommended for Most Users)
2222
- [Enable custom Teams apps and turn on custom app uploading](https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/prepare-your-o365-tenant#enable-custom-teams-apps-and-turn-on-custom-app-uploading) (optional: Teams extension only)
@@ -33,18 +33,18 @@ This extension enables users to experience Chat with your data within Teams, wit
3333
![ENV](images/teams-1.png)
3434

3535
4. Locate the environment variable _AZURE_FUNCTION_URL_.
36-
5. Replace the `<RESOURCE_TOKEN>` and `<FUNCTION_APP_CLIENT_KEY>` with the name of your Function App resource and its clientKey (created in previous section)
36+
5. Replace the `<FUNCTION_APP_NAME>` and `<FUNCTION_KEY>` with your actual Function App name and function key
3737
```env
38-
AZURE_FUNCTION_URL=https://backend-<RESOURCE_TOKEN>.azurewebsites.net/api/GetConversationResponse?code=<FUNCTION_APP_CLIENT_KEY>&clientId=clientKey
38+
AZURE_FUNCTION_URL=https://<FUNCTION_APP_NAME>.azurewebsites.net/api/GetConversationResponse?code=<FUNCTION_KEY>
3939
4040
```
4141
![Env](images/teams-deploy-env.png)
4242
6. Save the file.
4343
7. Select Teams Toolkit from the navigation panel.
4444
45-
![Teams Toolkit in VS Code](images/teams-2.png)
45+
![Microsoft 365 Agents Toolkit in VS Code](images/teams-2.png)
4646
47-
8. Within the Teams Toolkit panel, login to the following accounts:
47+
8. Within the Microsoft 365 Agents Toolkit panel, login to the following accounts:
4848
4949
**Sign in to Microsoft 365**: Use your Microsoft 365 work or school account with a valid E5 subscription for building your app. If you don't have a valid account, you can join [Microsoft 365 developer program](https://developer.microsoft.com/microsoft-365/dev-program) to get a free account before you start.
5050

extensions/teams/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const config = {
22
botId: process.env.BOT_ID,
33
botPassword: process.env.BOT_PASSWORD,
44
azureFunctionUrl: process.env.AZURE_FUNCTION_URL,
5+
tenantId: process.env.TEAMS_APP_TENANT_ID,
56
};
67

78
export default config;

extensions/teams/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import config from "./config";
1919
const credentialsFactory = new ConfigurationServiceClientCredentialFactory({
2020
MicrosoftAppId: config.botId,
2121
MicrosoftAppPassword: config.botPassword,
22-
MicrosoftAppType: "MultiTenant",
22+
MicrosoftAppType: "SingleTenant",
23+
MicrosoftAppTenantId: config.tenantId
2324
});
2425

2526
const botFrameworkAuthentication = new ConfigurationBotFrameworkAuthentication(

extensions/teams/infra/azure.bicep

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
@maxLength(20)
1+
@maxLength(25)
22
@minLength(4)
33
@description('Used to generate names for all resources in this file')
44
param resourceBaseName string
55

66
@description('Required when create Azure Bot service')
77
param botAadAppClientId string
88

9+
@description('Required when using SingleTenant or UserAssignedMSI app type')
10+
param botAadAppTenantId string
11+
912
@secure()
1013
@description('Required by Bot Framework package in your bot project')
1114
param botAadAppClientSecret string
@@ -69,6 +72,10 @@ resource webApp 'Microsoft.Web/sites@2021-02-01' = {
6972
name: 'AZURE_FUNCTION_URL'
7073
value: azureFunctionURL
7174
}
75+
{
76+
name: 'TEAMS_APP_TENANT_ID'
77+
value: botAadAppTenantId
78+
}
7279
]
7380
ftpsState: 'FtpsOnly'
7481
}
@@ -81,6 +88,7 @@ module azureBotRegistration './botRegistration/azurebot.bicep' = {
8188
params: {
8289
resourceBaseName: resourceBaseName
8390
botAadAppClientId: botAadAppClientId
91+
botAadAppTenantId: botAadAppTenantId
8492
botAppDomain: webApp.properties.defaultHostName
8593
botDisplayName: botDisplayName
8694
}

extensions/teams/infra/azure.parameters.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"botAadAppClientId": {
99
"value": "${{BOT_ID}}"
1010
},
11+
"botAadAppTenantId": {
12+
"value": "${{TEAMS_APP_TENANT_ID}}"
13+
},
1114
"botAadAppClientSecret": {
1215
"value": "${{SECRET_BOT_PASSWORD}}"
1316
},

extensions/teams/infra/botRegistration/azurebot.bicep

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@maxLength(20)
1+
@maxLength(25) // Changed from 20 to 25 to match parent template
22
@minLength(4)
33
@description('Used to generate names for all resources in this file')
44
param resourceBaseName string
@@ -10,24 +10,27 @@ param botServiceName string = resourceBaseName
1010
param botServiceSku string = 'F0'
1111
param botAadAppClientId string
1212
param botAppDomain string
13+
param botAadAppTenantId string
1314

1415
// Register your web service as a bot with the Bot Framework
15-
resource botService 'Microsoft.BotService/botServices@2021-03-01' = {
16+
resource botService 'Microsoft.BotService/botServices@2023-09-15-preview' = {
1617
kind: 'azurebot'
1718
location: 'global'
1819
name: botServiceName
1920
properties: {
2021
displayName: botDisplayName
2122
endpoint: 'https://${botAppDomain}/api/messages'
2223
msaAppId: botAadAppClientId
24+
msaAppType: 'SingleTenant'
25+
msaAppTenantId: botAadAppTenantId
2326
}
2427
sku: {
2528
name: botServiceSku
2629
}
2730
}
2831

2932
// Connect the bot service to Microsoft Teams
30-
resource botServiceMsTeamsChannel 'Microsoft.BotService/botServices/channels@2021-03-01' = {
33+
resource botServiceMsTeamsChannel 'Microsoft.BotService/botServices/channels@2023-09-15-preview' = {
3134
parent: botService
3235
location: 'global'
3336
name: 'MsTeamsChannel'

extensions/teams/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"build": "tsc --build",
1717
"start": "node ./lib/index.js",
1818
"watch": "nodemon --exec \"npm run start\"",
19-
"test": "echo \"Error: no test specified\" && exit 1"
19+
"test": "echo \"Error: no test specified\" && exit 1",
20+
"enable-sp": "node ./scripts/enable-service-principal.js"
2021
},
2122
"repository": {
2223
"type": "git",

0 commit comments

Comments
 (0)