Skip to content

Commit 7763f12

Browse files
Merge branch 'dev' into hb-bug-23482
2 parents 94bf8e7 + baf6c6d commit 7763f12

22 files changed

+182
-97
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,17 @@ jobs:
2525
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
2626
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
2727
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
28+
PRINCIPAL_ID: ${{ secrets.PRINCIPAL_ID }}
29+
PRINCIPAL_NAME: ${{ secrets.PRINCIPAL_NAME }}
30+
PRINCIPAL_TYPE: 'ServicePrincipal'
2831

2932
outputs:
3033
imageTag: ${{ steps.set-image-tag.outputs.imageTag }}
3134
web_url: ${{ steps.extract-urls.outputs.web_url }}
3235
admin_url: ${{ steps.extract-urls.outputs.admin_url }}
3336
DEPLOYMENT_SUCCESS: ${{ steps.final-status.outputs.DEPLOYMENT_SUCCESS }}
37+
resource_group: ${{ steps.check_create_rg.outputs.RESOURCE_GROUP_NAME }}
38+
solution_suffix: ${{ steps.generate_solution_prefix.outputs.SOLUTION_SUFFIX }}
3439

3540
steps:
3641
- name: Checkout code
@@ -203,6 +208,9 @@ jobs:
203208
DISABLE_AUTHENTICATION=true
204209
NO_AUTH=true
205210
SKIP_AUTH=true
211+
PRINCIPAL_ID
212+
PRINCIPAL_NAME
213+
PRINCIPAL_TYPE
206214
207215
- name: Extract URLs from deployment
208216
id: extract-urls
@@ -299,8 +307,6 @@ jobs:
299307
300308
echo "=== PostgreSQL Configuration Summary ==="
301309
echo "Host Endpoint: $PG_HOST_DESTINATION"
302-
echo "Username: admintest (hardcoded)"
303-
echo "Password: Initial_0524 (hardcoded)"
304310
echo "Database: postgres (hardcoded)"
305311
echo "Port: 5432 (hardcoded)"
306312
@@ -311,19 +317,28 @@ jobs:
311317

312318
- name: Install Python dependencies
313319
run: |
314-
pip install psycopg2-binary python-dotenv
315-
320+
pip install psycopg2-binary python-dotenv azure-identity
316321
317322
- name: Populate PostgreSQL Database
318323
run: |
319324
python - <<EOF
320325
import os
321326
import psycopg2
327+
from azure.identity import ClientSecretCredential
328+
329+
tenant_id = os.environ["AZURE_TENANT_ID"]
330+
client_id = os.environ["AZURE_CLIENT_ID"]
331+
client_secret = os.environ["AZURE_CLIENT_SECRET"]
332+
pg_host = os.environ.get("PG_HOST_DESTINATION", "localhost")
333+
334+
# Acquire Azure AD access token for PostgreSQL
335+
credential = ClientSecretCredential(tenant_id, client_id, client_secret)
336+
token = credential.get_token("https://ossrdbms-aad.database.windows.net/.default").token
322337
323338
db_params = {
324-
"user": "admintest",
325-
"password": "Initial_0524",
326-
"host": os.environ.get("PG_HOST_DESTINATION", "localhost"),
339+
"user": client_id, # Use service principal clientId
340+
"password": token, # Use AAD token instead of password
341+
"host": pg_host,
327342
"port": "5432",
328343
"dbname": "postgres",
329344
"sslmode": "require"
@@ -343,8 +358,10 @@ jobs:
343358
except Exception as e:
344359
print(f"❌ Error during import: {e}")
345360
EOF
346-
347-
361+
env:
362+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
363+
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
364+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
348365

349366
- name: Final Status Check
350367
id: final-status
@@ -386,9 +403,10 @@ jobs:
386403
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
387404
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
388405
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
389-
AZURE_ENV_NAME: ${{ github.run_id }}
406+
AZURE_ENV_NAME: ${{ needs.deploy.outputs.solution_suffix }} # Get from deploy job
390407
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
391408
imageTag: ${{ needs.deploy.outputs.imageTag }}
409+
AZURE_RESOURCE_GROUP: ${{ needs.deploy.outputs.resource_group }}
392410

393411
steps:
394412
- name: Checkout code
@@ -408,6 +426,7 @@ jobs:
408426
AZURE_SUBSCRIPTION_ID
409427
AZURE_ENV_NAME
410428
AZURE_LOCATION
429+
AZURE_RESOURCE_GROUP
411430
412431
- name: Send Notification on Failure
413432
if: failure()

.github/workflows/create-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on:
22
workflow_run:
3-
workflows: ["CI"]
3+
workflows: ["Validate Deployment"]
44
types:
55
- completed
66

Makefile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ azd-login: ## 🔑 Login to Azure with azd and a SPN
5757
@echo -e "\e[34m$@\e[0m" || true
5858
@azd auth login --client-id ${AZURE_CLIENT_ID} --client-secret ${AZURE_CLIENT_SECRET} --tenant-id ${AZURE_TENANT_ID}
5959

60-
azd-login: ## 🔑 Login to Azure with azd and a SPN
61-
@echo -e "\e[34m$@\e[0m" || true
62-
@azd auth login --client-id ${AZURE_CLIENT_ID} --client-secret ${AZURE_CLIENT_SECRET} --tenant-id ${AZURE_TENANT_ID}
63-
64-
# Fixed Makefile section for deploy target
6560
# Fixed Makefile section for deploy target
6661
deploy: azd-login ## Deploy everything to Azure
6762
@echo -e "\e[34m$@\e[0m" || true
@@ -126,15 +121,10 @@ deploy: azd-login ## Deploy everything to Azure
126121
echo "$$PG_HOST_VAL" > pg_host.txt
127122

128123

129-
130-
131-
132124
@echo "=== PostgreSQL Configuration ==="
133-
@echo "Username: admintest (hardcoded)"
134125
@echo "Database: postgres (hardcoded)"
135126
@echo "Port: 5432 (hardcoded)"
136127
@echo "Host: $$(cat pg_host.txt 2>/dev/null || echo 'Not available')"
137-
@echo "Password: Initial_0524 (hardcoded)"
138128

139129
# Helper target to check current authentication status
140130
check-auth:
@@ -178,4 +168,5 @@ disable-auth-fixed:
178168

179169
destroy: azd-login ## 🧨 Destroy everything in Azure
180170
@echo -e "\e[34m$@\e[0m" || true
171+
@azd env select $(AZURE_ENV_NAME) || true
181172
@azd down --force --purge --no-prompt

docs/LOCAL_DEPLOYMENT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ Execute the above [shell command](#L81) to run the function locally. You may nee
280280
|AZURE_SEARCH_TITLE_COLUMN||Field from your Azure AI Search index that gives a relevant title or header for your data content to display in the UI.|
281281
|AZURE_SEARCH_TOP_K|5|The number of documents to retrieve from Azure AI Search.|
282282
|AZURE_SEARCH_URL_COLUMN||Field from your Azure AI Search index that contains a URL for the document, e.g. an Azure Blob Storage URI. This value is not currently used.|
283-
|AZURE_SEARCH_USE_INTEGRATED_VECTORIZATION ||Whether to use [Integrated Vectorization](https://learn.microsoft.com/en-us/azure/search/vector-search-integrated-vectorization)|
283+
|AZURE_SEARCH_USE_INTEGRATED_VECTORIZATION ||Whether to use [Integrated Vectorization](https://learn.microsoft.com/en-us/azure/search/vector-search-integrated-vectorization). If the database type is PostgreSQL, set this to false.|
284284
|AZURE_SEARCH_USE_SEMANTIC_SEARCH|False|Whether or not to use semantic search|
285285
|AZURE_SPEECH_RECOGNIZER_LANGUAGES | en-US,fr-FR,de-DE,it-IT | Comma-separated list of languages to recognize from speech input|
286286
|AZURE_SPEECH_REGION_ENDPOINT | | The regional endpoint of the Azure Speech service|
@@ -299,7 +299,7 @@ Execute the above [shell command](#L81) to run the function locally. You may nee
299299
|OPEN_AI_FUNCTIONS_SYSTEM_PROMPT | | System prompt for OpenAI functions orchestration|
300300
|ORCHESTRATION_STRATEGY | openai_function | Orchestration strategy. Use Azure OpenAI Functions (openai_function), Semantic Kernel (semantic_kernel), LangChain (langchain) or Prompt Flow (prompt_flow) for messages orchestration. If you are using a new model version 0613 select any strategy, if you are using a 0314 model version select "langchain". Note that both `openai_function` and `semantic_kernel` use OpenAI function calling. Prompt Flow option is still in development and does not support RBAC or integrated vectorization as of yet.|
301301
|SEMANTIC_KERNEL_SYSTEM_PROMPT | | System prompt used by the Semantic Kernel orchestration|
302-
|USE_ADVANCED_IMAGE_PROCESSING | false | Whether to enable the use of a vision LLM and Computer Vision for embedding images|
302+
|USE_ADVANCED_IMAGE_PROCESSING | false | Whether to enable the use of a vision LLM and Computer Vision for embedding images. If the database type is PostgreSQL, set this to false.|
303303
|USE_KEY_VAULT | true | Whether to use Azure Key Vault for storing secrets|
304304

305305
## Bicep

docs/TEAMS_LOCAL_DEPLOYMENT.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,21 @@ Or use the [Azure Functions VS Code extension](https://marketplace.visualstudio.
2929
2. Open the file env\\.env.local
3030
3. Locate the environment variable _AZURE_FUNCTION_URL_.
3131

32-
4. Replace the `<AZURE_FUNCTION_URL>` with your local Teams Backend URL (i.e., http://localhost:7071/api/GetConversationResponse)
32+
4. Update the environment variables in the file with your local development URLs:
33+
- Replace the `<AZURE_FUNCTION_URL>` placeholder with your local Teams Backend Function URL: `http://localhost:7071/api/GetConversationResponse`
34+
- Set the `AZURE_APP_API_BASE_URL` to your local API URL: `http://127.0.0.1:5050/`
35+
3336
```env
3437
AZURE_FUNCTION_URL=http://localhost:7071/api/GetConversationResponse
38+
AZURE_APP_API_BASE_URL=http://127.0.0.1:5050/
3539
```
3640
![Env](images/teams-local-3.png)
3741
3842
5. Save the file.
39-
6. Select Teams Toolkit from the navigation panel.
40-
7. Verify your signed into O365 and Azure with sideloading enabled.
41-
8. Select the "play" button next to Local.
43+
6. For local development, ensure that multitenant mode is enabled in the Teams extension. In `index.ts`, check that the `MicrosoftAppType` is set to "MultiTenant" instead of "SingleTenant"
44+
7. Select Teams Toolkit from the navigation panel.
45+
8. Verify your signed into O365 and Azure with sideloading enabled.
46+
9. Select the "play" button next to Local.
4247
4348
![Teams Toolkit](images/teams-local-2.png)
4449

docs/advanced_image_processing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,5 @@ azd env set ADVANCED_IMAGE_PROCESSING_MAX_IMAGES 2
4646
```
4747

4848
Advanced image processing is only used in the `custom` conversation flow and not the `byod` flow, as Azure OpenAI On Your Data only supports Ada embeddings. It is currently not possible to use advanced image processing when integrated vectorization is enabled.
49+
50+
Advanced image processing is not supported when deploying with PostgreSQL as the database type.

docs/integrated_vectorization.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,5 @@ If you have a deployment with Integrated Vectorization enabled, and you want to
4949
![Delete Search Index](images/delete-search-datasource.png)
5050
1. Run the command `azd env set AZURE_SEARCH_USE_INTEGRATED_VECTORIZATION false`
5151
1. Run `azd up`
52+
53+
**NOTE**: Integrated vectorization is not supported when deploying with PostgreSQL as the database type.

docs/teams_extension.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ This extension enables users to experience Chat with your data within Teams, wit
3232

3333
![ENV](images/teams-1.png)
3434

35-
4. Locate the environment variable _AZURE_FUNCTION_URL_.
36-
5. Replace the `<FUNCTION_APP_NAME>` and `<FUNCTION_KEY>` with your actual Function App name and function key
35+
4. Locate the environment variables _AZURE_FUNCTION_URL_ and _AZURE_APP_API_BASE_URL_.
36+
5. Replace the `<FUNCTION_APP_NAME>` and `<FUNCTION_KEY>` with your actual Function App name and function key, and replace `<APP-NAME>` with your actual App Service name
3737
```env
3838
AZURE_FUNCTION_URL=https://<FUNCTION_APP_NAME>.azurewebsites.net/api/GetConversationResponse?code=<FUNCTION_KEY>
39-
39+
AZURE_APP_API_BASE_URL=https://<APP-NAME>.azurewebsites.net/
4040
```
4141
![Env](images/teams-deploy-env.png)
4242
6. Save the file.
4343
7. Select Teams Toolkit from the navigation panel.
4444
45+
![Microsoft 365 Agents Toolkit in VS Code](images/teams-2.png)
4546
![Microsoft 365 Agents Toolkit in VS Code](images/teams-2.png)
4647
4748
8. Within the Microsoft 365 Agents Toolkit panel, login to the following accounts:

extensions/teams/cards/cardBuilder.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { Attachment, CardFactory } from "botbuilder";
22
import { Citation, CardType } from "../model";
3+
import config from "../config";
34

45
export function actionBuilder(citation: Citation, docId: number): any {
56

6-
const urlParts = citation.url.split("]");
7-
let url = urlParts[urlParts.length - 1].replaceAll("(", "").replaceAll(")", "");
87
let title = citation.title.replaceAll("/documents/", "");
8+
const filename = title;
9+
let fileApiUrl = `${config.getFileEndpoint}/${filename}`;
910
let content = citation.content.replaceAll(citation.title, "").replaceAll("url", "");
1011
content = content.replaceAll(/(<([^>]+)>)/ig, "\n").replaceAll("<>", "");
1112
let citationCardAction = {
@@ -37,7 +38,7 @@ export function actionBuilder(citation: Citation, docId: number): any {
3738
{
3839
type: CardType.OpenUrl,
3940
title: "Go to the source",
40-
url: decodeURI(url),
41+
url: decodeURI(fileApiUrl),
4142
}
4243
]
4344
}

extensions/teams/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ const config = {
22
botId: process.env.BOT_ID,
33
botPassword: process.env.BOT_PASSWORD,
44
azureFunctionUrl: process.env.AZURE_FUNCTION_URL,
5+
azureAppApiBaseUrl: process.env.AZURE_APP_API_BASE_URL,
56
tenantId: process.env.TEAMS_APP_TENANT_ID,
7+
getFileEndpoint: process.env.AZURE_APP_API_BASE_URL ?
8+
`${process.env.AZURE_APP_API_BASE_URL}api/files` :
9+
null,
610
};
711

812
export default config;

0 commit comments

Comments
 (0)